Skip to content

STM Exception "BlockedIndefinitelyOnSTM" throws to wrong thread

This might be two bugs. The attached test file (tvarTest.hs) aims to use a separate thread catching a "BlockedIndefinitelyOnSTM" exception to adjust the state of another TVar (a poor mans finalizer on TVars).

More concretely, with TVars "b" and "i" I have a thread (running "gcTVar") retrying on a read of "i" then alters "b" if/when the BlockIndefinitelyOnSTM exception is received. My main thread waits for the state of "b" to change (which is should, due to "gcTVar").

Unfortunately, compiling with GHC (6.12.3, 7.0.1, 7.0.3, threaded or not, optimized or not, it all behaves the same) the main thread receives the exception and not the thread running "gcTVar".

The behavior is different in GHCi. GHCi seems to operate correctly.

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