#4493: Child from forkProcess calls select/read on parent's Handle, stealing 
data
from parent
-------------------------------+--------------------------------------------
    Reporter:  josh            |       Owner:                             
        Type:  bug             |      Status:  new                        
    Priority:  normal          |   Component:  Runtime System             
     Version:  6.12.1          |    Keywords:                             
    Testcase:  yes             |   Blockedby:                             
          Os:  Linux           |    Blocking:                             
Architecture:  x86_64 (amd64)  |     Failure:  Incorrect result at runtime
-------------------------------+--------------------------------------------
 In trying out [http://git-annex.branchable.com/ git-annex] on a large
 repository, I ran into a strange bug where git-annex would try to operate
 on a filename that consisted of the beginning of one filename spliced
 together with the end of another filename.  After staring at strace output
 for a while, I tracked down the problem, though not the root cause.  git-
 annex would call pipeFrom (from MissingH's System.Cmd.Utils), which (by
 way of hPipeFrom) would call forkProcess to get a child process, and then
 call dupTo, close the original fd, and call execProcess to run the
 specified process.  The parent process, in turn, would call fdToHandle on
 the other end of the pipe, and then pipeFrom would call hGetContents on
 that handle.  In the version of git-annex I originally tested (the 0.04
 release), more than one of these pipes might run at once.  strace showed
 that on occasion, the child process created by forkProcess would call
 select on the file descriptor for a *previous* pipe, and read from that
 previous pipe, stealing data from the parent process; it would do this at
 some point after starting and before calling exec.

 I reproduced this problem with 6.12.1 and 6.10.4, both with and without
 -threaded.  The analysis of the strace given above came from 6.12.1
 without -threaded.  (Note that with -threaded, strace would fail at
 runtime, with "PANIC: attached pid $SOMEPID exited with 0"; see
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=603187 .  So, I don't
 have an strace to analyze from -threaded.)

 I can reliably reproduce this problem.  Please let me know if I can
 provide any further information.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4493>
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