[GHC] #10545: Deadlock in the threaded RTS

#10545: Deadlock in the threaded RTS -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: new Priority: highest | Milestone: 7.10.2 Component: Runtime | Version: 7.10.1 System | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- The following program deadlocks with high probability: {{{ -- ghc -rtsopts -threaded -debug performGC.hs -- ./performGC 1000 +RTS -qg -N2 -- -qg turns off parallel GC, needed to trigger the bug -- -N2 or greater is needed module Main (main) where import System.Environment import Control.Concurrent import Control.Exception import Control.Monad import System.Random import System.Mem import qualified Data.Set as Set main = do [n] <- getArgs forkIO $ doSomeWork forM [1..read n] $ \n -> do print n; threadDelay 1000; performMinorGC doSomeWork :: IO () doSomeWork = forever $ do ns <- replicateM 10000 randomIO :: IO [Int] ms <- replicateM 1000 randomIO let set = Set.fromList ns elems = filter (`Set.member` set) ms evaluate $ sum elems }}} There are a few ways that this bug can be triggered: * At shutdown, when there are other threads still running. This is how we first encountered it. * Using `performGC`, as above. I think it's necessary to call it from a bound thread (e.g. the main thread) to get bad things to happen. * I think `forkProcess` might also trigger it, but I haven't observed it. I'm working on a fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10545 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10545: Deadlock in the threaded RTS
-------------------------------------+-------------------------------------
Reporter: simonmar | Owner: simonmar
Type: bug | Status: new
Priority: highest | Milestone: 7.10.2
Component: Runtime System | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Simon Marlow

#10545: Deadlock in the threaded RTS -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Runtime System | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonmar): * status: new => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10545#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10545: Deadlock in the threaded RTS -------------------------------------+------------------------------------- Reporter: simonmar | Owner: simonmar Type: bug | Status: closed Priority: highest | Milestone: 7.10.2 Component: Runtime System | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10` (I also pulled in be0ce8718ea40b091e69dd48fe6bc62b6b551154). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10545#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC