[GHC] #11041: EventLog write fails if entire buffer is not written

GHC ghc-devs at haskell.org
Sun Nov 1 00:40:18 UTC 2015


#11041: EventLog write fails if entire buffer is not written
-------------------------------------+-------------------------------------
           Reporter:  sseverance     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Runtime        |           Version:  7.10.2
  System                             |
           Keywords:  eventlog       |  Operating System:  Unknown/Multiple
       Architecture:  x86_64         |   Type of failure:  None/Unknown
  (amd64)                            |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

 The function printAndClearEventBuf uses 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 -l flag.

 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11041>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list