#4533: IO manager can leak MVars if threads are killed
---------------------------------+------------------------------------------
    Reporter:  bos               |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  Compiler                   
     Version:  7.0.1             |    Keywords:                             
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------
 If a thread is killed in {{{threadWaitRead}}} and no data ever comes in on
 the file descriptor it was waiting on, the IO manager will not remove the
 {{{FdData}}} structure from its queue of waited-for events. This causes
 the queue to slowly grow in size.

 Test case:
 {{{
 -- Compile with: ghc -threaded --make

 import Control.Monad
 import Control.Concurrent

 main = do
   forM_ [0..10000] $ \i -> do
     when (i`mod`100==0) $ print i
     t <- forkIO $ threadWaitRead 0
     threadDelay 5000
     killThread t
 }}}

 This is not hugely likely to affect real programs, but could lead to a
 (perhaps accidental) denial of service against a long-running application.

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