[GHC] #12221: GHC's signal handlers break C-c C-c force terminate

#12221: GHC's signal handlers break C-c C-c force terminate -------------------------------------+------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- GHC RTS has a policy that if it can't neatly shut off after the first C-c, it will forcibly terminate after the second one. This works all very well, until we reprogram the signal handler: {{{ import Panic main = do installSignalHandlers let f x | x == 0 = 0 :: Int | otherwise = f (x + 1) print (f (1 :: Int)) }}} Compile this with {{{ ezyang@sabre:~$ ghc-8.0 --make M.hs -O -package ghc ezyang@sabre:~$ ./M ^C^C^C^C^C^C^C^C^Z [1]+ Stopped ./M ezyang@sabre:~$ kill -9 %1 [1]+ Killed ./M }}} So yeah, that's a pain. What this means is that if GHC itself infinite loops, you can't ^C it. Maybe #10686 is exactly this, but my diagnosis doesn't seem to be consistent with their workaround in Leksah. In particular, this program still does not accept C-C: {{{ import Panic import System.Posix.Signals (emptySignalSet, sigINT, addSignal, unblockSignals) main = do installSignalHandlers unblockSignals $ addSignal sigINT emptySignalSet let f x | x == 0 = 0 :: Int | otherwise = f (x + 1) print (f (1 :: Int)) }}} #4162 is people asking GHC to NOT install signal handlers unless we are running GHCi; this would also solve the problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12221 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12221: GHC's signal handlers break C-c C-c force terminate -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ezyang): * owner: ezyang => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12221#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC