IO manager can leak MVars if threads are killed
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | tibbe |
| Operating system | |
| Architecture |