Skip to content

STM transaction left open if there is an orElse on the path between throwSTM and catchSTM

main = join $ atomically $ do
  catchSTM
    (throwSTM ThreadKilled `orElse` return (putStrLn "wtf"))
    (\(e::SomeException) -> return (putStrLn "ok"))

This program crashes with a segmentation fault. Tested with GHC HEAD.

I attach the testcase and my proposed fix for the issue. I've run the fast testsuite with the proposed fix without new defects. On the other hand I'm very new to GHC, so while I'm sure in the defect and the test, the fix may be bogus.

Thanks goes to Mihály Bárász for discovering the issue.

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
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