On Tue, 25 Feb 2003, Simon Marlow wrote:

> 
> > Something like the following seems to be occurring.
> > 
> > The program `Concurrent.forkIO`s several threads.  Two of 
> > these auxiliary
> > threads each fork a process (with `GHC.Conc.forkProcess`).  
> > Just as the
> > second forked process is about to `Posix.executeFile`, it 
> > appears that the
> > "ghost" of the original thread (with ID 1) in that 
> > process--which is not
> > supposed to exist in the new process--suffers the "thread blocked
> > indefinitely" exception.  (Each of my threads protects itself with
> > `Exception.catch` and tags caught exceptions with process and 
> > thread IDs.)
> > It is likely that, in the original process, the original thread was
> > waiting on a `readChan` at the time of the `forkProcess`.
> 
> Looking at the code for forkProcess, it appears that "main threads" are
> not killed in the child process.  Thread 1 is almost certainly a main
> thread, which explains why it isn't being killed.
> 
> This is a deficiency in forkProcess (which I wasn't aware of, or had
> forgotten).  It looks like the right thing to do is to make the current
> thread into the (one and only) main thread in the child process at fork
> time.
> 
> In the meantime, could you perhaps fork from the main thread instead?

I'm now `GHC.Conc.forkProcess`ing only from the initial thread, and all   
seems well.  Thanks for the suggestion!
 
Any idea when `forkProcess` might get fixed?  Don't hurry on my
account; I'm just curious.

Dean


_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to