EventLog write fails if entire buffer is not written
Recently I was trying to use ThreadScope to run down a performance issue. I ran into what I believe is a corner case with flushing the eventlog data to disk. The program was generating hundreds of millions of events every few minutes.
fwrite to flush the buffer to disk. What I observed is that with larger buffers it would only succeed in writing the first 4096 bytes. After it would print out its
debugBelch message a number of times the program would crash. It does not crash if not run with the eventlog
My understanding is that
fwrite might need to be called in a loop to ensure that all data is written.
fwrite is not guaranteed to always write the entire requested buffer.
I don't have a good test case for this, but if there is agreement about potential issues with flushing the buffer I am more than happy to provide a patch.