[GHC] #8006: Asynchronous exception rethrown synchronously inside runStmt

GHC ghc-devs at haskell.org
Fri Jun 28 12:21:04 CEST 2013


#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 simonmar):

 Simon - normally a thunk is frozen when hit by an asynchronous exception,
 but the problem is when we have an `unsafePerformIO` or
 `unsafeInterleaveIO` inside the thunk, and the IO code catches the
 asynchronous exception and re-throws it.  When it re-throws the exception
 there are two options:

  * re-throw it as a synchronous exception.  But then any enclosing thunks
 will capture the exception. This is what happens right now in the
 typechecker and other parts of GHC; it's the bug we want to fix.

  * re-throw the exception asynchronously.  You can do this by calling
 `throwTo` passing your own `ThreadId`.  Leaving aside the question of how
 you know that the original exception was asynchronous (which we don't have
 a good answer to, see #5902), the problem here is that when the current
 execution is resumed in the future, `throwTo` will ''return'', and then
 you have to figure out what to do: re-execute the whole operation, or
 something else?

 Hope that helps.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/8006#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list