Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3997 closed bug (fixed)

Lazy I/O and asynchronous exceptions don't mix well

Reported by: simonmar Owned by:
Priority: normal Milestone: 7.0.1
Component: libraries/base Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This program:

import Control.Concurrent
import Control.Exception

main = do
  s <- getContents
  t <- forkIO $ evaluate (length s) >> return ()
  threadDelay 1000
  killThread t
  print (length s)

results in

$ ./async            
async: thread killed

when really it should just wait for input.

The problem is #2558, but since I'm not sure that #2558 has a general solution (see comments on that ticket) I thought I'd open a ticket for this specific case. It's amazing nobody has complained about this before.

Change History (2)

comment:1 Changed 9 years ago by simonmar

patch: 0
Resolution: fixed
Status: newclosed

I've fixed this in the IO library:

Wed Apr 21 10:49:32 BST 2010  Simon Marlow <>
  * raise asynchronous exceptions asynchronously (#3997)

comment:2 Changed 7 years ago by simonmar

difficulty: Unknown

another instance of this bug: #5866

Note: See TracTickets for help on using tickets.