RTS flushTrace function doesn't flush the eventlog
flushTrace function flushes the eventlog file descriptor, but doesn't flush the event buffers to that descriptor.
For example, here's a fragment of RTS startup code:
/* Trace some basic information about the process */ traceWallClockTime(); // (1) traceOSProcessInfo(); // (2) flushTrace(); // (3)
The intention of this code is to have this info at the very beginning of the eventlog. But I observe these events near the very end for my programs. Looks like (1) and (2) write to some memory buffers but don't touch the eventlog file descriptor, and (3) is flushing said descriptor but doesn't flush said memory buffer.
Steps to reproduce
Compile some meaningful multithreaded program with
-eventlog -threaded and run with
+RTS -l -N. I could probably attach something small but sufficient if necessary.
Observe that the Wallclock event is somewhere not at the beginning of the eventlog.
WallClock event being at the beginning of the eventlog file, before events emitted by the application code like
- GHC version used: 8.8.3, 8.10.1
- Operating System: macOS high sierra
- System Architecture: x86_64