Repository navigation
Conversation
…essages The legacy handshake iterators busy-waited on the message queue, so an idle Handshake stream kept a server executor thread at full CPU before authentication. Block on the queue and wake the reader with an end-of-stream marker instead.
Arawoof06
requested review from
jbonofre,
laurentgo,
lidavidm and
wgtmac
as code owners
November 19, 2026 06:17
jbonofre
requested changes
Nov 19, 2026
| final byte[] bytes; | ||
| try { | ||
| bytes = messages.take(); | ||
| } catch (InterruptedException e) { |
Member
There was a problem hiding this comment.
When take() is interrupted, this exception exits doClientAuth before the outbound handshake stream is completed or cancelled. The server can remain blocked waiting for a client message.
I would signal an error on the request stream before propagating the interruption.
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.
What's Changed
ServerAuthWrappergives the legacyServerAuthHandleran iterator whosenext()spins onLinkedBlockingQueue.poll()until the client sends a handshake message or closes the stream.ServerAuthInterceptorlets Handshake through without a token, so on a server configured with a legacy handler such asBasicServerAuthHandler, an unauthenticated client can open Handshake streams, send nothing, and keep one executor thread per stream at full CPU for as long as the stream stays open.ClientAuthWrapperspins the same way on the client while waiting for the server's reply.next()now blocks ontake().onCompleted/onErrorenqueue an end-of-stream marker so a waiting reader wakes up and throws the same exceptions as before, andhasNext()ignores the marker. Valid handshakes are unaffected.Measured against a
FlightServerwithBasicServerAuthHandler, with 4 Handshake streams opened and left idle for 3 s:TestBasicAuth.handshakeBlocksWhileWaitingForClientopens an idle Handshake and checks that the server thread isWAITING. It fails without the fix (expected: <WAITING> but was: <RUNNABLE>). The flight-core tests pass with the fix.