
#10199: Sending SIGINT to a program that uses forkOS may crash with various errors -------------------------------------+------------------------------------- Reporter: adeon | Owner: simonmar Type: bug | Status: new Priority: low | Milestone: Component: Runtime | Version: 7.10.1 System | Operating System: Linux Keywords: | Type of failure: Runtime crash Architecture: x86_64 | Blocked By: (amd64) | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- This is the program: {{{#!hs module Main ( main ) where import Control.Concurrent import Control.Monad main :: IO () main = recursive 0 where recursive n = do tid <- forkIO $ do replicateM_ 100 $ forkOS $ return () replicateM_ (n `mod` 1000) yield recursive (n+1) }}} I was trying to investigate a potential issue with leaking StablePtrs in forkOS but that's another story. Compile with {{{ghc Main.hs -prof -auto-all -threaded -o Main}}}. Run as {{{./Main +RTS -h}}} (I don't know if it's absolutely necessary to turn heap profiling on but I have more trouble getting these error messages without it). Then, stop the program with SIGINT (by pressing CTRL+C or otherwise). The program sometimes crashes and produces one of the these two error messages: {{{ Main: internal error: RELEASE_LOCK: I do not own this lock: rts/Task.c 242 (GHC version 7.10.1 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} {{{ Main: newBoundTask: RTS is not initialised; call hs_init() first }}} Sometimes the message may be slightly garbled (notice double internal error below): {{{ Î: internal error: Main: internal error: RELEASE_LOCK: I do not own this lock: rts/Task.c 242 (GHC version 7.10.1 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Replacing forkOS with forkIO seems to stop the messages. I can't reproduce this on FreeBSD. I'm using the downloaded binaries of 7.10.1 from GHC site on Arch Linux. I used this simple bash script to see more of these messages because it won't crash reliably: {{{#!bash #!/bin/bash while true; do timeout -s INT 0.2 ./Main +RTS -h done }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10199 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler