#1188: STM.c:stmCommitNestedTransaction bogosity
-------------------------------+--------------------------------------------
    Reporter:  ms43            |       Owner:          
        Type:  bug             |      Status:  new     
    Priority:  normal          |   Milestone:          
   Component:  Runtime System  |     Version:  6.6     
    Severity:  normal          |    Keywords:          
  Difficulty:  Easy (1 hr)     |    Testcase:          
Architecture:  Multiple        |          Os:  Multiple
-------------------------------+--------------------------------------------
there is a superfluous if (result) in stmCommitNestedTransaction in STM.c.
 as a consequence, if check_read_only returns non-zero, revert_ownership
 will not be called, which means that when the transaction is restarted and
 reads a variable, that TVar will still be locked by the previous attempt,
 resulting in an infinite loop in readTVar.

 here is a patch (against ghc 6.6 darcs checked out on 2007-02-18).


 {{{
 --- /home/ms/www/ghc/rts/STM.c  2007-02-18 19:52:42.000000000 +0100
 +++ ./STM.c     2007-03-02 23:27:53.000000000 +0100
 @@ -1013,7 +1013,6 @@
        // at the end of the call to validate_and_acquire_ownership.  This
 forms the
        // linearization point of the commit.

 -      if (result) {
          TRACE("%p : read-check succeeded\n", trec);
          FOR_EACH_ENTRY(trec, e, {
            // Merge each entry into the enclosing transaction record,
 release all
 @@ -1027,9 +1026,8 @@
            merge_update_into(cap, et, s, e -> expected_value, e ->
 new_value);
            ACQ_ASSERT(s -> current_value != (StgClosure *)trec);
          });
 -      } else {
 +    } else {
          revert_ownership(trec, FALSE);
 -      }
      }
    }
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1188>
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