[GHC] #8453: segfault/assertion failure with multi-threaded profiling

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 7.7 Keywords: | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: Runtime crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ----------------------------------+---------------------------------- Steps to reproduce: {{{ ghc-stage2 selector_thunks.hs -rtsopts -fforce-recomp -prof -threaded -debug -O2 ./selector_thunk +RTS -N4 }}} In a few seconds, it either segfaults or dies with the following error message: {{{ selector_thunks: internal error: ASSERTION FAILED: file rts/dist/build/sm/Evac_thr.c, line 778 (GHC version 7.7.20131002 for x86_64_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} selector_thunks.hs: {{{ import Control.Monad import Control.Concurrent import Data.IORef main = do gref <- newIORef [return ()] forM_ [0::Int ..10] $ \_ -> forkIO $ do ref <- newIORef [return ()] forever $ do list <- readIORef gref writeIORef ref $! reverse list acts <- readIORef ref last acts forM_ [1..100000099] $ \i -> writeIORef gref $! reverse $ concatMap (replicate 10) $ mapfst $ foldr (\x y -> seq x (x : y)) [] $ map f [1..10+ (div i 1000000)] mapfst :: [(a, b)] -> [a] mapfst [] = [] mapfst (x:xs) = (case x of (a, _) -> a) : mapfst xs f :: Int -> (IO (), Int) f x = (x `seq` return (), x) }}} I only tested the code with a recent HEAD, but I have seen a similar assertion failure with GHC 7.6.3, in a non-contrived application program. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: akio Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Changes (by akio): * owner: => akio -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: akio Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by akio): The attached patch fixes the assertion failure. However the code still segfaults, now inside Haskell code rather than in the RTS. It looks like this segfault is new and was not present in b84fbab. I'll continue to debug this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: akio Type: bug | Status: new Priority: normal | Milestone: Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: 8402 Blocking: | Related Tickets: ----------------------------------+---------------------------------- Changes (by akio): * blockedby: => 8402 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: akio Type: bug | Status: patch Priority: normal | Milestone: Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: 8402 Blocking: | Related Tickets: ----------------------------------+---------------------------------- Changes (by akio): * status: new => patch Comment: After the fix to #8402, the attached patch allows the test program to run fine. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling
----------------------------------+----------------------------------
Reporter: akio | Owner: akio
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Profiling | Version: 7.7
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: | Blocked By: 8402
Blocking: | Related Tickets:
----------------------------------+----------------------------------
Comment (by Austin Seipp

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: akio Type: bug | Status: patch Priority: normal | Milestone: Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: 8402 Blocking: | Related Tickets: ----------------------------------+---------------------------------- Comment (by thoughtpolice): Confirmed bug and that the patch fixes it - excellent work Takano, thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: thoughtpolice Type: bug | Status: patch Priority: high | Milestone: 7.8.1 Component: Profiling | Version: 7.7 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: 8402 Blocking: | Related Tickets: ----------------------------------+---------------------------------- Changes (by thoughtpolice): * owner: akio => thoughtpolice * priority: normal => high * milestone: => 7.8.1 Comment: This still needs a testcase. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8453: segfault/assertion failure with multi-threaded profiling ----------------------------------+---------------------------------- Reporter: akio | Owner: thoughtpolice Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Profiling | Version: 7.7 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: 8402 Blocking: | Related Tickets: ----------------------------------+---------------------------------- Changes (by thoughtpolice): * status: patch => closed * resolution: => fixed Comment: I left this open to track adding the bug to the testsuite, but unfortunately there's no real easy way to do this, it seems. Closing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8453#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC