Fix advance_time re-entrancy guard leaking on early return/exception#220
Open
gomezzz wants to merge 2 commits into
Open
Fix advance_time re-entrancy guard leaking on early return/exception#220gomezzz wants to merge 2 commits into
gomezzz wants to merge 2 commits into
Conversation
2 tasks
advance_time set _is_advancing_time=True before validating its arguments and only cleared it on the normal return path, so any early return (radiation events) or exception left the guard stuck True, poisoning every subsequent call with a spurious 'advance_time is already running' assertion. In real-time activity mode the measured interval can round to zero, tripping the positive-time assert, which crashed the background ActivityProcessor and deadlocked wait_for_activity. Release the guard in a finally block, treat a zero interval as a no-op, and skip zero-length processor updates instead of asserting.
gomezzz
force-pushed
the
fix/advance-time-reentrancy
branch
from
July 24, 2026 09:33
5e48f0f to
f9fc9df
Compare
2 tasks
Covers the two failure modes fixed here: a zero-length interval is a no-op that never engages the guard, and an exception mid-advance_time still releases it so a subsequent call succeeds (previously deadlocked). Also corrects the ActivityProcessor._update comment now that advance_time handles zero intervals itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PASEOS.advance_timeset its re-entrancy guard_is_advancing_time = Truebefore validating arguments and only cleared it on the normal return path. Any early return (radiation restart/death) or exception therefore left the guard stuckTrue, so every subsequent call failed theassert not self._is_advancing_time("advance_time is already running").In real-time activity mode the measured interval between processor updates can round to zero;
advance_time(0)then tripped the positive-time assert, poisoned the guard, crashed the backgroundActivityProcessor, and deadlockedwait_for_activity.finallyblock so it is always cleared.ActivityProcessor._updateinstead of asserting.No behavioural change on the normal path; the fix only affects the leak/cleanup and zero-length edge cases.
Test plan
Stacked on the uv PR (#221) so it inherits the green uv CI; independent of the tooling changes and can be re-parented onto
mainif you'd rather merge it on its own.