fix: dispatch first non-initialize request from the service loop - #1263
Open
DaleSeo wants to merge 1 commit into
Open
fix: dispatch first non-initialize request from the service loop#1263DaleSeo wants to merge 1 commit into
DaleSeo wants to merge 1 commit into
Conversation
DaleSeo
marked this pull request as ready for review
September 12, 2026 15:17
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.
Fixes #1261.
Motivation and Context
When a client skips
initializeandserver/discoverand sends something liketools/callas its very first message over stdio,serve_server_with_ct_innerused to await the handler inline before startingserve_inner.Peer::send_notification, and thereforenotify_progress,notify_logging_message, and similar methods, waits on a oneshot. That oneshot is resolved only when the loop drainspeer_rxand writes to the transport. So if the handler sent a notification before returning, it blocked forever, and the client never received either the notification or the response.The fix passes the pre-read request to
serve_innerthrough a newinitial_messagesparameter. This seeds the loop's existingbatch_messagesqueue. The request is dispatched in wire order before anything else is read from the transport, while the loop is already drainingpeer_rx. As a result, the first request now gets the same things as every other request handled by the loop, including alocal_ct_poolentry sonotifications/cancelledworks, and theORIGINATING_REQUESTtask-local scope.How Has This Been Tested?
Added tests
Breaking Changes
None.
Types of changes
Checklist