[GHC] #9295: Deadlock in forkProcess

#9295: Deadlock in forkProcess ------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- As part of `forkProcess` we discard all tasks except the one task that remains. As part of this we call `freeTask`, and `freeTask` in turn calls `closeCondition` and `closeMutex`, which are very thin wrappers around `pthread_cond_destroy` and `phread_mutex_destroy`. However, the behaviour of these functions is undefined when there are currently threads blocked on these condition variables/mutexes. In reality, this undefined behaviour often (though not always) results in a deadlock. Unfortunately, I don't have a minimal test case to demonstrate this, but in the large system on which I am testing this I am seeing these deadlocks rather frequently. For the global mutex we don't attempt to call `pthread_cond_destroy` or `pthread_mutex_destroy`, but instead re-initialize them. The patch https://phabricator.haskell.org/D59 does precisely that for the condition variables and mutexes associated with tasks. This is ''somewhat'' or a long way around, because we will then subsequently still call `pthread_..._destroy`, but it means that we don't have to mess with `freeTask`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------ Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by snoyberg): * cc: snoyberg (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------ Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by AndreasVoellmy): * cc: AndreasVoellmy (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: => 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D59 | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * differential: => Phab:D59 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.4 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D59 | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed * milestone: 7.8.3 => 7.8.4 Comment: This was merged and will be part of 7.8.4. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9295: Deadlock in forkProcess -------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.4 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D59 | -------------------------------------+------------------------------------- Comment (by thomie): In case Phabricator references are not permanent: fixed in commit 39630ab15cc0607103dc4ef3d9089de44ef17c2d. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9295#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC