Drain buffered GDB packets before polling - #369
Merged
Conversation
The RSP transport can read several requests at once, but the session polls the socket before consuming each request. Remaining requests stall when the client waits for their replies without sending more data. Consume buffered input before polling. Add a regression that sends eight requests together and requires every reply without another socket write.
jserv
reviewed
Sep 4, 2026
jserv
reviewed
Sep 4, 2026
jserv
reviewed
Sep 4, 2026
|
|
||
| if sys.argv[2] == "batch": | ||
| # No further socket writes may wake the stub while replies are pending. | ||
| sock.sendall(frame_packet("qAttached") * 8) |
Contributor
There was a problem hiding this comment.
Nothing forces the stub to coalesce these eight frames into one read(). If they arrive split, the unfixed loop polls, finds data, and answers all eight, so the guard passes against the bug it exists to catch. 112 bytes in one loopback write makes that unlikely, but the test does not say it is relying on that.
Suzu1Dev
marked this pull request as draft
September 4, 2026 22:17
The session loop and transport decoder both decide when buffered input is exhausted. Share the transport predicate so changes to the buffer representation have one definition to update.
Force two requests into one transport read and require both replies before any further client input. Exercise the real session with a nonblocking poll wrapper so an unconditional poll fails on the missing reply instead of hanging the test. Run the host case from the GDB and shared check lanes. Compare reply checksum text against the sender's two-digit lowercase format, and document the TCP batch test's coalescing assumption.
Suzu1Dev
marked this pull request as ready for review
September 5, 2026 00:07
Contributor
|
Thank @Suzu1Dev for contributing! |
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.
The RSP transport can read several requests at once, but the session polls
the socket before consuming each request. A debugger waiting for replies
without sending more data leaves the buffered requests stalled. Consume
buffered input before polling again.
Reproduce by negotiating QStartNoAckMode, then sending eight framed
qAttached requests in one write. The regression requires all eight exact,
checksum-valid replies without another socket write. The subprocess exit
status also participates in the raw RSP test verdict.
Validated on Apple M3 Pro, macOS 27.0 (26A5425a), SDK 26.5:
Summary by cubic
Fixes the GDB stub stalling when a single socket read buffers multiple RSP packets. Previously the session polled for new input before consuming each buffered request, so a client waiting for replies without sending more data could stall indefinitely. The session now drains buffered packets before polling again, with the buffer-exhaustion check shared between the session loop and transport decoder. A deterministic host regression forces two requests into one transport read, requires both exact, checksum-valid replies before any further client input, and runs in the shared and GDB check lanes.
Written for commit 6ad8748. Summary will update on new commits.