STM.c:stmCommitNestedTransaction bogosity
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);
- }
}
}
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Multiple |
Architecture | Multiple |