diff --git a/code/traceanc.c b/code/traceanc.c index a6f4f3f49c..f1e7d4d010 100644 --- a/code/traceanc.c +++ b/code/traceanc.c @@ -634,6 +634,17 @@ Res ArenaStartCollect(Globals globals, TraceStartWhy why) res = TraceStartCollectAll(&trace, arena, why); if(res != ResOK) goto failStart; + + /* The trace has been flipped, so the mutator may hit the read + * barrier on a grey segment as soon as the arena is released. + * TraceRankForAccess needs the trace to be past its initial band, + * RankAMBIG, but the band only advances in traceFindGrey. + * ArenaRelease advances the trace only if a poll is due, so advance + * it once here, as TracePoll and ArenaStep do after starting a + * trace. Afterwards either the band is past RankAMBIG or no + * segment is grey for the trace. */ + TraceAdvance(trace); + ArenaRelease(globals); return ResOK;