Repository navigation
fix(rizin): abort in-flight debug session starts when the manager closes - #11020
Merged
Merged
Conversation
OwnedDebuggerSessionRegistry now owns in-flight starts: it relays the caller's abort, aborts each start as owner-closed on close and waits for it, and reports the caller's reason when the caller aborted first. GDB's private start map and Rizin's counter-and-waiters drain are removed; Rizin's closeAll previously waited for a start without aborting it.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issue was established. SummaryMoves in-flight start tracking into
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Manager accepts a start"] --> B["Registry records its controller"]
B --> C["Start runs with the owned signal"]
D["Manager closes"] --> E["Block new starts"]
E --> F["Abort tracked starts"]
F --> G["Wait for starts and their cleanup"]
C --> G
G --> H["Close retained sessions and resources"]
Reviews (1) · Last reviewed commit: "fix(rizin): abort in-flight debug sessio..." · Reviewed by Greptile |
22 tasks
2 tasks done
19 tasks
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
Closing the Rizin debug session manager now aborts in-flight session starts as owner-closed, as GDB already did. Start tracking moves into
OwnedDebuggerSessionRegistry, so both debuggers follow one rule.Problem and expected behavior
RizinDebugSessionManager.closeAll()waited for in-flight starts (a counter plus waiters) but never aborted them. A start blocked in ownership preparation, spawn or the startup frame wait without a caller signal keptcloseAll()waiting until the start finished on its own; if it never finished, close never returned.GdbSessionManageraborted its starts (#activeStartsmap of AbortControllers) withOwnerCancellation.ownerClosedand then awaited them.Expected: closing either manager aborts each in-flight start as owner-closed, waits for it to settle, and then closes the sessions. A caller abort that came first is still reported with the caller's reason.
Change and scope
OwnedDebuggerSessionRegistry.start(operation, callerSignal, run)registers a start before awaiting, relays the caller's abort, and, when the caller aborted first, rewrites a cancellation with the caller's reason (the GDB rule, now shared).abortStarts()aborts every in-flight start as owner-closed and waits for each to settle.cancelledWithCallerReasonmoves fromGdbSessionManagerto the registry module; GDB imports it for its other uses.#activeStartsmap and relay removed;closeAllcallsabortStarts().#activeStartscounter and#startDrainWaitersremoved; starts run through the registry;closeAllcallsabortStarts()before closing sessions and TTY resources.bindCleanupDependenciescall incancelledWithCallerReasonmoved with it (GdbSessionManager.ts3 → 2,OwnedDebuggerSessionRegistry.ts0 → 1). The total is unchanged.Not included: Rizin still refuses a start made after
closeAllbegan with anAnalysisInputErrorthat namesinferior_tty; GDB returns an owner-closed cancellation there. That is a separate user-visible change, proposed as a follow-up.Scope decision: not applicable (lifecycle fix within existing boundaries; coordinator decision for W4f).
Contract and boundary impact
OwnedDebuggerSessionRegistrynow owns in-flight starts (relay, owner-closed abort, drain, caller-reason precedence). GDB's and Rizin's local copies are removed.AnalysisCancelledError(owner-closed) instead of running to completion.spawnOwnedProviderProcessonly for pre-spawn ownership inspection, so a session's process lifetime is not tied to it.Expected effects:
Evidence and regression coverage
RizinDebugSessionReviewRegressions.test.ts› "aborts an in-flight Rizin start as owner-closed when the manager closes". Its spawn waits until the start is aborted.closeAll()must return, and the start must reportAnalysisCancelledErrorwith causeOwnerCancellation.ownerClosed.src/rizin/RizinDebugSessionManager.tsfromorigin/main, the test times out (closeAll never returns, and the afterEach hook times out too). With this change it passes.platform: "linux"injected.Validation performed
npx vitest run --project boundary tests/boundary/providers/RizinDebugSessionReviewRegressions.test.ts tests/boundary/providers/GdbSessionManagerCoverage.test.ts tests/boundary/providers/RizinDebugSessionAdmission.test.ts tests/boundary/providers/RizinTtyCleanup.test.ts: 4 files, 228 passed, 2 skipped.npm run check:fast: passed.node scripts/verify/architecture-guards.mjs: passed (after the baseline move above).npx oxfmt --checkon the changed files: passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.