#4493: Child from forkProcess calls select/read on parent's Handle, stealing 
data
from parent
-------------------------------+--------------------------------------------
    Reporter:  josh            |        Owner:                             
        Type:  bug             |       Status:  infoneeded                 
    Priority:  high            |    Milestone:  7.0.2                      
   Component:  Runtime System  |      Version:  6.12.1                     
    Keywords:                  |     Testcase:  yes                        
   Blockedby:                  |   Difficulty:                             
          Os:  Linux           |     Blocking:                             
Architecture:  x86_64 (amd64)  |      Failure:  Incorrect result at runtime
-------------------------------+--------------------------------------------

Comment(by joeyhess):

 Josh may have a better test case, but it can be reproduced by the
 following.

 {{{
 import System.Cmd.Utils
 main = do
         (h, stream) <- pipeFrom "find" ["."]
         mapM (\file -> pipeFrom "ls" ["-l", file]) $ lines stream
 }}}

 This code is intentionally itself bad, and will leak FDs a lot, but if
 you run it in a directory with lots of contents, you'll see that
 sometimes, before dying due to too many open FDs, it runs `ls` with a
 parameter that is not a complete line output by `find`, due to the data
 stealing problem.

 Here I run it in ghc's own source tree:

 {{{
 j...@wren:~/tmp/ghc6-6.12.1>runghc ~/testcase.hs
 ls: cannot access ./.pc/alpha-tcforeign/systemTests/A/c_src/hello.c: No
 such
 file or directory
 ls: cannot access ./libraries/Cabal/tests/ow: No such file or directory
 repo.hs: createPipe: resource exhausted (Too many open files)
 j...@wren:~/tmp/ghc6-6.12.1>find |grep libraries/Cabal/tests/ow
 j...@wren:~/tmp/ghc6-6.12.1>
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4493#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to