[GHC] #2155: More deadlock issues with concurrent I/O

GHC trac at galois.com
Thu Mar 13 19:40:04 EDT 2008


#2155: More deadlock issues with concurrent I/O
-------------------------------+--------------------------------------------
    Reporter:  dfranke         |       Owner:          
        Type:  bug             |      Status:  new     
    Priority:  normal          |   Component:  Compiler
     Version:  6.8.2           |    Severity:  major   
    Keywords:                  |    Testcase:          
Architecture:  x86_64 (amd64)  |          Os:  Linux   
-------------------------------+--------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2155>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list