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

GHC ghc-devs at haskell.org
Mon Mar 9 17:21:27 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):

 Thanks thomie! I think I see what is happening now: the TimerManager
 registers a file descriptor with the RTS for use by the
 `ioManagerWakeup()` function in `rts/posix/Signals.c`. When the
 TimerManager shuts down, it closes this file descriptor. I think there is
 a race condition where rts/Schedule.c calls `ioManagerWakeup()` after the
 TimerManager has shutdown. The TimerManager should only shutdown when the
 program is exiting, so it's probably safe to simply silently ignore the
 failing write, although this probably needs some review.

 In the meantime, I've modified `GHC/Event/Control.hs` to write `-1` to
 `io_manager_wakeup_fd` just before it closes the file descriptor. This
 should address the race condition. Can you compile your ghc with the
 attached Control.hs and check whether it makes the problem go away for
 you?

 Thanks!

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


More information about the ghc-tickets mailing list