
#8209: Race condition in setNumCapabilities -------------------------------------+---------------------------------- Reporter: akio | Owner: simonmar Type: bug | Status: new Priority: highest | Milestone: 7.8.1 Component: Runtime System | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Comment (by akio): I found another error (reproducible with the same code). {{{moreCapabilities}}} calls {{{memcpy}}} to copy {{{Capability}}}s. This means the {{{lock}}} field is also copied. If the {{{lock}}} field of the old {{{Capability}}} is held by another thread, the new copy of {{{lock}}} is also in the held state. However it will never be released, because the actual lock held is the old {{{lock}}}, not the new one. The task running {{{setNumCapabilities()}}} then deadlocks trying to acquire this lock. (By the way copying a mutex seems to be an undefined behavior according to the pthread spec) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8209#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler