
#14310: Assertion triggered by STM invariant. ----------------------------------+-------------------------------------- Reporter: mbw | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+-------------------------------------- Comment (by bgamari): So I think I see one issue: in the event that `validate_and_acquire_ownership(cap, trec, (!use_read_phase), true);` in `stmCommitTransaction` returns `false` we will never unlock the invariants that we previously locked. I suspect we'll want something like this, {{{#!patch diff --git a/rts/STM.c b/rts/STM.c index 5c8fd4ff40..02ac22519b 100644 --- a/rts/STM.c +++ b/rts/STM.c @@ -1441,6 +1441,17 @@ StgBool stmCommitTransaction(Capability *cap, StgTRecHeader *trec) { } else { revert_ownership(cap, trec, false); } + } else { + // we encountered inconsistency; unlock the invariants that we locked as we + // are giving up on committing. + if (touched_invariants) { + StgInvariantCheckQueue *q = trec -> invariants_to_check; + while (q != END_INVARIANT_CHECK_QUEUE) { + StgAtomicInvariant *inv = q -> invariant; + unlock_inv(inv); + q = q -> next_queue_entry; + } + } } unlock_stm(trec); }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14310#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler