#4449: GHC 7 can't do IO when demonized
----------------------------+-----------------------------------------------
  Reporter:  kazu-yamamoto  |          Owner:  adept      
      Type:  bug            |         Status:  new        
  Priority:  normal         |      Milestone:  7.0.2      
 Component:  Compiler       |        Version:  7.1        
Resolution:                 |       Keywords:  forkProcess
  Testcase:                 |      Blockedby:             
Difficulty:                 |             Os:  MacOS X    
  Blocking:                 |   Architecture:  x86        
   Failure:  None/Unknown   |  
----------------------------+-----------------------------------------------

Comment(by adept):

 More info: the first two calls for `closeControl` are made from `withNew`
 (System/Event/Manager.hs). I don't know enough about weak IORefs to
 understand what's happening to them over fork, but this is definitely a
 root cause. When innermost process tries to initialize its event manager,
 the following code is executed:
 {{{
 newWith be =
   ...
   _ <- mkWeakIORef state $ do
                st <- atomicModifyIORef state $ \s -> (Finished, s)
                when (st /= Finished) $ do
                  I.delete be
                  closeControl ctrl
   ...
 }}}

 and after that something (my guess is `threadDelay`) forces the value
 inside that weak IO Ref, pulling state corresponding to the "parent" io
 managers through `I.delete` and `closeControl`.

 Since two "outer" processes have the same kqueue FD numbers, repeated
 `I.delete` produces the error we are observing.

 So far, I am at a loss how to fix this.

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