Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,829
    • Issues 4,829
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #4533

Closed
Open
Created Nov 26, 2010 by bos@trac-bos

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking