Skip to content

throwTo can block indefinitely when target thread finishes with exceptions blocked

throwTo can block indefinitely when the target thread has exceptions blocked at thread creation time. The following test program demonstrates this problem.

import Control.Exception
import GHC.Conc
  
main = do
    t1 <- block $ forkIO yield
    t2 <- forkIO $ killThread t1
    threadDelay 1000000
    threadStatus t1 >>= print
    threadStatus t2 >>= print

can print (and does fairly reliably for me)

ThreadFinished
ThreadBlocked BlockedOnException

See also http://www.haskell.org/pipermail/reactive/2009-January/000197.html

Trac metadata
Trac field Value
Version 6.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture x86
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information