[GHC] #8235: Race condition in IO manager

GHC ghc-devs at haskell.org
Sun Sep 8 18:44:55 CEST 2013


#8235: Race condition in IO manager
-------------------------------------+------------------------------------
        Reporter:  parcs             |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  libraries/base    |          Version:  7.7
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Runtime crash     |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:  910               |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by parcs):

 This is what I think is happening:

 1. The third call to `setNumCapabilities` causes the event manager on cap
 1 to be restarted via `restartPollLoop`.
 2. `restartPollLoop` forks a new poll loop.
 3. `main` finishes and the RTS begins shutting down.
 4. The RTS sends a die message to the timer manager.
 5. The RTS flushes its capabilities' run queues. The timer-manager thread
 is run first. The timer manager reads the die message and shuts down the
 event managers, setting each event manager's state to `Dying`.
 6. The original poll loop on cap 1 is run next. Its state variable reads
 `Dying`, so it shuts itself down. Its state variable is now `Finished`.
 7. The new poll loop on cap 1 is finally run for the first time. Its state
 variable initially reads `Finished`, so it throws an error.

 Does this make sense?

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




More information about the ghc-tickets mailing list