Repository navigation
fix(gdb): keep sessions usable after an oversized stream record - #8029
Conversation
A single MI console, target or log record over the 16 MiB line limit failed the whole session protocol, so close could not re-synchronize and GDB plus its inferior stayed owned with no recovery path. MI stream records carry only output and c-strings escape newlines, so a raw LF always ends the record. #receive now drops the remainder of an oversized stream record, marks pending command output and retained records truncated, and keeps parsing later lines; oversized result and async records still fail closed as before. Fixes morluto#8023.
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR keeps GDB sessions usable after an oversized console, target, or log record. It drops that record through its terminating LF and marks output as truncated.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MI record exceeds 16 MiB] --> B{Starts with console, target, or log prefix?}
B -->|Yes| C[Clear buffered record and mark output truncated]
C --> D[Skip through terminating LF]
D --> E[Read following MI records normally]
B -->|No| F[Fail the session protocol]
Reviews (1) · Last reviewed commit: "test(gdb): drop superseded oversized-rec..." · Reviewed by Greptile |
Codex Review SummaryThis 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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
I tested this PR at
This PR:
One small point. The truncated I also tested #8091, which takes the other approach: it closes the session and terminates GDB. The two look complementary. This PR keeps the session for oversized stream records. #8091's forced stop would still cover protocol failures that this PR leaves fail-closed, such as an oversized result record, which I didn't trigger. |
Summary
A single GDB console, target or log record over the 16 MiB MI line limit failed the whole session protocol. Close then could not verify detach, so GDB and the inferior stayed owned with no way out. MI stream records carry only output, and MI c-strings escape newlines, so a raw LF always ends the record.
#receivenow drops the rest of an oversized stream record, marks the commandoutput_truncated, and keeps the session usable. Oversized result and async records still stop the session, as before. Close and detach behavior are unchanged.Fixes #8023.
Validation
npm run test:focused -- tests/boundary/providers/GdbSessionManagerCoverage.test.ts tests/boundary/cli/gdbStartupCleanupCli.test.ts: 206 passed. The new stream-record test fails on main; the oversized result-record test passes on both.npm run check:fast,npm run docs:checkandgit diff --check: pass.Author readiness
Human owner: @rohitg00