Opened 7 years ago

Closed 7 years ago

#2155 closed bug (duplicate)

More deadlock issues with concurrent I/O

Reported by: dfranke Owned by: simonmar
Priority: normal Milestone: 6.8.3
Component: libraries/process Version: 6.8.2
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

The following hangs on the current ghc-STABLE snapshot, and shouldn't.

module Main where

import Control.Concurrent
import qualified Data.ByteString.Lazy.Char8 as B
import System.IO
import System.Process

launch :: B.ByteString -> IO B.ByteString
launch i = do (hin,hout,herr,ph) <- runInteractiveProcess "cat" [] Nothing Nothing
              -- forkIO $ collect ph  -- This doesn't seem to be relevant to the problem.
              forkIO $ do B.hPut hin i
                          hClose hin
              B.hGetContents hout

collect :: ProcessHandle -> IO ()
collect ph = do waitForProcess ph
                return ()

main :: IO ()
main = let i = B.pack "foo" in
       do o <- foldl (>>=) (return i) (take 5 (repeat launch))
          B.putStrLn o

See also #1936.

Change History (3)

comment:1 Changed 7 years ago by dfranke

  • Component changed from Compiler to Runtime System

comment:2 Changed 7 years ago by simonmar

  • Component changed from Runtime System to libraries/process
  • difficulty set to Unknown
  • Milestone set to 6.8.3
  • Owner set to simonmar

I strongly suspect this is the same as #1780, but leaving it open so that we can check.

comment:3 Changed 7 years ago by simonmar

  • Resolution set to duplicate
  • Status changed from new to closed

Now fixed, it was indeed a duplicate of #1780.

Note: See TracTickets for help on using tickets.