Skip to content

RTS crash while executing System.Process.system after forkProcess in separate thread

Summary

See below. Error does not manifest itself if run in GHCi or linked with -debug. It also does not get reproduced while running without forkIO.

Steps to reproduce

Repro case:

module Main where

import Control.Concurrent (forkIO, threadDelay)
import Control.Monad (when, mapM_)

import System.Mem

import System.IO
import System.Process (system)
import System.Posix.Process (forkProcess, getProcessStatus)

action :: Int -> IO ()
action arg = do
  pid <- forkProcess $ return ()
  getProcessStatus True False pid >>= print
  print (show arg ++ ": passed")

run :: Int -> IO ()
run n = threadDelay 20000 >> forkIO (action n >> system "true" >> return ()) >> performMajorGC

main :: IO ()
main = mapM_ run [1..]

Output I see:

Just (Exited ExitSuccess)
"1: passed"
Just (Exited ExitSuccess)
"2: passed"
Just (Exited ExitSuccess)
"3: passed"
Just (Exited ExitSuccess)
"4: passed"
RTS: internal error: evacuate: strange closure type 76
    (GHC version 8.8.3 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
Just (Terminated 6 True)
"5: passed"

After Ctrl+C twice:

RTS: internal error: evacuate: strange closure type 76
    (GHC version 8.8.3 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
Just (Terminated 11 True)
Just (Terminated 11 True)
Just (Terminated 6 True)

Environment

  • GHC version used: 8.8.3

Optional:

Linux viviag-HP 4.15.0-34-generic 37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information