Ticket #2411 (closed merge: fixed)
RaiseAsync and STM segfault with stop_at_atomically in some circumstances.
|Reported by:||sclv||Owned by:||igloo|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
x86_64 6.9 build from June 15. I can't distill it down to a single simple testcase, but the backtrace is very informative:
ASSERTION FAILED: file RaiseAsync?.c, line 1015
The assertion in question is "ASSERT(stmGetEnclosingTRec(tso->trec) == NO_TREC)". This assertion is only called when we hit an ATOMICALLY_FRAME with stop_at_atomically activated.
We only do that when Schedule.c is running the garbage collector and raises an exception to retry an invalid stm transaction. I don't follow enough here to offer a real patch, but obviously there is a false assumption that the transaction we're trying to retry does not have an enclosing trec. Why this may be the case is somewhat beyond me. I'm doing various things with unsafeIOToSTM, so I think the answer may be that there is some sort of forking going on with threaded IO which means that threads may have enclosing trecs.
#0 0x00002b134fdb9b45 in raise () from /lib64/libc.so.6 #1 0x00002b134fdbb0e0 in abort () from /lib64/libc.so.6 #2 0x00000000009b40e0 in rtsFatalInternalErrorFn (s=0xa2c670 "ASSERTION FAILED: file %s, line %u\n", ap=0x41000e50) at RtsMessages.c:164 #3 0x00000000009b3ca4 in barf (s=0xa2c670 "ASSERTION FAILED: file %s, line %u\n") at RtsMessages.c:40 #4 0x00000000009b3cfe in _assertFail (filename=0xa3200c "RaiseAsync.c", linenum=1015) at RtsMessages.c:55 #5 0x00000000009e4675 in raiseAsync (cap=0xd734a0, tso=0x2b1351bdb000, exception=0x0, stop_at_atomically=rtsTrue, stop_here=0x0) at RaiseAsync.c:1015 #6 0x00000000009e365b in throwToSingleThreaded_ (cap=0xd734a0, tso=0x2b1351bdb000, exception=0x0, ---Type <return> to continue, or q <return> to quit--- stop_at_atomically=rtsTrue, stop_here=0x0) at RaiseAsync.c:73 #7 0x00000000009b6b51 in scheduleDoGC (cap=0xd734a0, task=0xd8e750, force_major=rtsFalse) at Schedule.c:2046 #8 0x00000000009b5a9d in schedule (initialCapability=0xd734a0, task=0xd8e750) at Schedule.c:718 #9 0x00000000009b77db in workerStart (task=0xd8e750) at Schedule.c:2537 #10 0x00002b134fb73020 in start_thread () from /lib64/libpthread.so.0 #11 0x00002b134fe4df8d in clone () from /lib64/libc.so.6 #12 0x0000000000000000 in ?? ()