#7493: STM and TVar report incorrect results
  Reporter:  parcs                        |          Owner:                  
      Type:  bug                          |         Status:  new             
  Priority:  highest                      |      Milestone:  7.6.2           
 Component:  Runtime System               |        Version:  7.6.1           
Resolution:                               |       Keywords:                  
        Os:  Unknown/Multiple             |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  |     Difficulty:  Unknown         
  Testcase:                               |      Blockedby:                  
  Blocking:                               |        Related:                  

Comment(by fryguybob):

 It looks like this particular case is not accounted for.  If an outer
 transaction writes the inner transaction needs to compare with that value
 to know if it is an update, not with the originally read value (which we
 need for knowing if there was an update from outside).  Worse yet, the
 write we need to see could be several levels out.  Perhaps it would be
 better to fix it on the other side of things.  If a write doesn't update,
 then when we `merge_read_into` if the outer record entry ''is'' an update,
 then we know the inner has reversed the update.  But here we can't
 distinguish a write to match the expected value and a read (which we would
 not want to take as an indication that we should revert our outer update).

 Perhaps another approach could be to look when we do an `stmWriteTVar` to
 see if we are an inner transaction writing what matches the expected
 value.  If so, built a thunk (indirection?) so we are sure to get a new
 value that will be seen by the outer transaction.

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

Glasgow-haskell-bugs mailing list

Reply via email to