#2401: unsafeIOToSTM hangs with 64 bit multicore.
----------------------------+-----------------------------------------------
 Reporter:  sclv            |          Owner:         
     Type:  bug             |         Status:  closed 
 Priority:  normal          |      Milestone:  6.10.1 
Component:  Runtime System  |        Version:  6.8.3  
 Severity:  major           |     Resolution:  wontfix
 Keywords:                  |     Difficulty:  Unknown
 Testcase:                  |   Architecture:  Unknown
       Os:  Unknown         |  
----------------------------+-----------------------------------------------
Changes (by simonmar):

  * status:  new => closed
  * resolution:  => wontfix

Comment:

 I understand what's happening here.  Inside a transaction you're doing
 this:

 {{{
 unsafeIOToSTM $ putStrLn ".."
 }}}

 Now, `putStrLn` needs to take a lock on `stdin`.  But the STM
 implementation assumes it can abort a transaction at any time, and in this
 case it aborts a transaction in the middle of `putStrLn` (because it
 discovered the transaction was already invalid).  When it aborts the
 transaction, the exception handler in `putStrLn` is discarded (STM didn't
 expect there to be a real IO exception handler in the middle of a
 transaction).  So `stdin` remains locked, and the program eventually
 deadlocks.

 Perhaps we could fix this by throwing a real exception, but there's quite
 a large design space there, and in any case when using `unsafeIOToSTM`
 you're really on your own.  I'll put a big warning in the docs for
 `unsafeIOToSTM` though.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2401#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to