#3279: Segmentation fault in reactive program
-------------------------------+--------------------------------------------
    Reporter:  Baughn          |        Owner:  simonmar        
        Type:  bug             |       Status:  new             
    Priority:  high            |    Milestone:  6.12.1          
   Component:  Runtime System  |      Version:  6.11            
    Severity:  normal          |   Resolution:                  
    Keywords:                  |   Difficulty:  Unknown         
    Testcase:                  |           Os:  Unknown/Multiple
Architecture:  x86_64 (amd64)  |  
-------------------------------+--------------------------------------------
Comment (by Baughn):

 There was a bug inside Unamb.hs. I think I'd best paste the relevant
 code..

 race a b = block $ do
   v <- newEmptyMVar
   let f x = forkIO $ putCatch x v
   ta <- f a
   tb <- f b

 - We rely on killing the threads forked here in order to limit excessive
 work, but as you can see I'd forgotten to unblock exceptions first.
 Switching to a corrected implementation

 race a b = block $ do
   v <- newEmptyMVar
   let f x = forkIO $ putCatch (unblock x) v
   ta <- f a
   tb <- f b

 removed that problem. It also removed the crash. However, I have a feeling
 it may still exist in potentia, as a race condition. At any rate, that's a
 place to start; exceptions thrown to blocked threads that go on to
 evaluate bottoms.

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