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

GHC ghc-devs at haskell.org
Mon Mar 9 22:28:14 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 Andreas Voellmy <andreas.voellmy@…>):

 In [changeset:"74625d6847e970e8bdc6991c327515b3e10b231b/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="74625d6847e970e8bdc6991c327515b3e10b231b"
 RTS/IOManager: fix trac issue #9722.

 Summary:
 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.

 This patch solves the problem by (1) having the TimerManager (via
 Control) write -1 to io_manager_wakeup_fd just before closing the file
 descriptor written in io_manager_wakeup_fd, and (2) having
 ioManagerWakeup() ignore an error returned by write() in the case that
 the write returned -1 and the io_manager_wakeup_fd is -1.

 Reviewers: austin, simonmar, hvr, thomie

 Reviewed By: thomie

 Subscribers: thomie

 Differential Revision: https://phabricator.haskell.org/D722

 GHC Trac Issues: #9722
 }}}

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


More information about the ghc-tickets mailing list