[GHC] #10545: Deadlock in the threaded RTS

GHC ghc-devs at haskell.org
Fri Jun 26 08:31:53 UTC 2015


#10545: Deadlock in the threaded RTS
-------------------------------------+-------------------------------------
        Reporter:  simonmar          |                   Owner:  simonmar
            Type:  bug               |                  Status:  new
        Priority:  highest           |               Milestone:  7.10.2
       Component:  Runtime System    |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by Simon Marlow <marlowsd@…>):

 In [changeset:"111ba4beda4ffc48381723da12e5b237d7f9ac59/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="111ba4beda4ffc48381723da12e5b237d7f9ac59"
 Fix deadlock (#10545)

 yieldCapability() was not prepared to be called by a Task that is not
 either a worker or a bound Task.  This could happen if we ended up in
 yieldCapability via this call stack:

 performGC()
 scheduleDoGC()
 requestSync()
 yieldCapability()

 and there were a few other ways this could happen via requestSync.
 The fix is to handle this case in yieldCapability(): when the Task is
 not a worker or a bound Task, we put it on the returning_workers
 queue, where it will be woken up again.

 Summary of changes:

 * `yieldCapability`: factored out subroutine waitForWorkerCapability`
 * `waitForReturnCapability` renamed to `waitForCapability`, and
   factored out subroutine `waitForReturnCapability`
 * `releaseCapabilityAndQueue` worker renamed to `enqueueWorker`, does
   not take a lock and no longer tests if `!isBoundTask()`
 * `yieldCapability` adjusted for refactorings, only change in behavior
   is when it is not a worker or bound task.

 Test Plan:
 * new test concurrent/should_run/performGC
 * validate

 Reviewers: niteria, austin, ezyang, bgamari

 Subscribers: thomie, bgamari

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

 GHC Trac Issues: #10545
 }}}

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


More information about the ghc-tickets mailing list