[GHC] #9401: MVar deadlock exceptions cause exceptions in later MVar ops
GHC
ghc-devs at haskell.org
Mon Aug 4 08:15:52 UTC 2014
#9401: MVar deadlock exceptions cause exceptions in later MVar ops
-------------------------------------+-------------------------------------
Reporter: snoyberg | Owner: simonmar
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Runtime | Version: 7.8.2
System | Keywords:
Resolution: invalid | Architecture: x86_64 (amd64)
Operating System: Linux | Difficulty: Unknown
Type of failure: Incorrect | Blocked By:
result at runtime | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Changes (by simonmar):
* status: new => closed
* resolution: => invalid
Comment:
This isn't a bug. There are two threads: the main thread, blocked in
readMVar, and the child thread, blocked in takeMVar. BOTH threads are
deadlocked, so the RTS sends them both an exception. It has no way to
tell that unblocking the child thread would later allow the main thread to
make progress, or indeed whether the reverse might be true. So the rule
is simple: when there are a group of deadlocked threads, they are all sent
an exception simultaneously.
There's a similar example in my book,
[http://chimera.labs.oreilly.com/books/1230000000929/ch15.html#sec_deadlock],
see `deadlock1.hs`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9401#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list