
#8006: Asynchronous exception rethrown synchronously inside runStmt ---------------------------------+------------------------------------------ Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Comment(by edsko): "I don't think an asynch exn should ever become the value of a thunk." -- yes, that would be ideal. Unfortunately, that's very hard to do, because there is no way to install an exception handler for synchronous exceptions only -- in particular, the almost-primitive `GHC.IO.catchException` catches all exceptions, does a runtime type check, and rethrows the exception using `raiseIO#` if the types don't match. This means that asynchronous exceptions become synchronous, and hence can become the value of a thunk. Manually re-throwing the exception using `throwTo` is not really a solution either (at least, not a generic solution, though sometimes a possible workaround), as then we need to decide in user code how to resume the thread. The ghc bugs I cite at the start of the issue are all related to this problem. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/8006#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler