You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes a crash in EventProcessor.enqueue where calling add_child on an already-completed parent EventFuture would raise a RuntimeError. The fix adds a not parent_future.done() guard so late-arriving chained events are silently orphaned from their parent rather than crashing.
event_processor.py: A single-line guard (and not parent_future.done()) is added before parent_future.add_child(tracked). Because asyncio is single-threaded, there is no race between the done() check and the add_child call. The orphaned child's parent reference is preserved, so _try_clean_future can still walk up the chain and remove the parent from _futures once the child completes.
test_event_processor.py: A regression test manually seeds a done parent future into the processor's _futures map, enqueues a child event with that parent's txid, and asserts the child runs successfully while done_parent.children remains empty.
Confidence Score: 5/5
Safe to merge — the change is a one-line targeted guard with a direct regression test, and the surrounding asyncio machinery is unaffected.
The guard is correct for asyncio's single-threaded cooperative model: no await exists between the done() check and add_child, so no interleaving is possible. The child's parent field is preserved despite skipping add_child, allowing _try_clean_future to walk the parent chain and remove the parent from _futures once the orphaned child completes. The test covers the exact crash scenario and verifies both the child's execution and the parent's empty children list.
Adds a not parent_future.done() guard before add_child to avoid a RuntimeError when a late-chained event arrives after its parent future has already resolved.
Adds a regression test verifying that enqueueing against an already-done parent future doesn't crash and that the child event still executes successfully.
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
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.
No description provided.