[GHC] #7930: Nested STM Invariants are lost

GHC cvs-ghc at haskell.org
Fri May 24 18:26:24 CEST 2013


#7930: Nested STM Invariants are lost
----------------------------------------+-----------------------------------
Reporter:  fryguybob                    |          Owner:  fryguybob       
    Type:  bug                          |         Status:  new             
Priority:  normal                       |      Component:  Runtime System  
 Version:  7.6.3                        |       Keywords:  STM             
      Os:  Unknown/Multiple             |   Architecture:  Unknown/Multiple
 Failure:  Incorrect result at runtime  |      Blockedby:                  
Blocking:                               |        Related:                  
----------------------------------------+-----------------------------------
 Invariants from a successful nested transaction should be merged with the
 parent.

 {{{
 import Control.Concurrent
 import Control.Concurrent.STM

 main = do
     x <- atomically $
         do a <- newTVar True
            (always (readTVar a) >> retry) `orElse` return ()
            return a
     atomically (writeTVar x False) -- Should not and does not fail

     y <- atomically $
         do a <- newTVar True
            always (readTVar a) `orElse` return ()
            return a
     atomically (writeTVar y False) -- Should fail, but does not!

     putStrLn "Ahhh!"

     z <- atomically $
         do a <- newTVar True
            always (readTVar a)
            return a
     atomically (writeTVar z False) -- should and does fail
 }}}

 I know how to fix this.  I'll have a patch with some tests and a fix soon.

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



More information about the ghc-tickets mailing list