[GHC] #9722: ghcirun004 intermittently fails with ghc: ioManagerWakeup: write: Bad file descriptor

GHC ghc-devs at haskell.org
Mon Mar 9 18:43:13 UTC 2015


#9722: ghcirun004 intermittently fails with ghc: ioManagerWakeup: write: Bad file
descriptor
-------------------------------------+-------------------------------------
        Reporter:  ezyang            |                   Owner:  simonmar
            Type:  bug               |                  Status:  patch
        Priority:  high              |               Milestone:  7.10.1
       Component:  Runtime System    |                 Version:  7.9
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Runtime crash     |  Unknown/Multiple
      Blocked By:                    |               Test Case:  ghcirun004
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:  Phab:D714
-------------------------------------+-------------------------------------

Comment (by AndreasVoellmy):

 OK great!

 To summarize: Whenever the RTS has been inactive for idleGCDelayTime, the
 idle timer fires and calls `wakeUpRts()`, which in turn calls
 `ioManagerWakeup()`, which in turn writes a byte (or a few) to a file
 descriptor (stored in the `io_manager_wakeup_fd` variable) registered by
 the TimerManager and on which the TimerManager will wait. (Note that the
 write will only occur if the file descriptor is non-negative.)  When the
 RTS shuts down, it shuts down the TimerManager, and in this process the
 file descriptor stored in `io_manager_wakeup_fd` is closed.  In the error
 case, the idle timer fires after the close of the file occurs, and then
 the `write()` call in `ioManagerWakeup()` fails and the aforementioned
 error message gets printed.

 I think the solution in the Control.hs modification is solid; it addresses
 the problem without silently ignoring other error conditions due to the
 `write()`. Another solution might be to disable the idle timer once the
 program shutdown sequence has started, though that could have more far-
 reaching effects, so I think the minor Control.hs modification is good for
 now.

 I'll clean it up, add a comment or two, and then make a patch.

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


More information about the ghc-tickets mailing list