Skip to content

bracket not running the final action on termination through SIGTERM

If a program compiled with GHC receives a SIGTERM signal, while in a bracket, the final action of the bracket isn't executed. This can be tested with this program:

import Control.Exception
import Control.Concurrent

main = bracket (return "ending")
       (\x -> putStrLn x)
       (\_ -> threadDelay 10000000000)

When running this and interrupting with ctrl-c (thus SIGINT) it prints "ending", like expected. When interrupting it with killall -TERM test (assuming the program was named test) "ending" isn't printed and the program terminates immediately. It prints a system specific message though.

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