Repository navigation
Fix UQUICConn Close after cancellation and preset transport parameters - #425
Open
StarProxima wants to merge 1 commit into
Open
StarProxima wants to merge 1 commit into
StarProxima wants to merge 1 commit into
Conversation
UQUICConn.Close did not wait on signalc after canceling the handshake, as QUICConn.Close does since crypto/tls fixed golang/go#77274 (23b5a72). Closing a UQUICConn whose context was canceled during the handshake could block forever. SetTransportParameters only set quic.transportParams, which a ClientHello built from a preset does not use: ApplyPreset clones the spec, so the QUICTransportParametersExtension that is marshaled is the clone. The parameters never reached the peer. Store them in that extension. TestUQUICPresetTransportParameters and TestUQUICContextCancelation fail without the change: the server receives empty transport parameters, and the cancellation test hangs.
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.
Two
UQUICConnproblems that show up when uTLS is used under a QUIC stack (we hit them with Xray's Hysteria transport after moving to the Chrome 155 preset):1.
Closehangs after the handshake context is canceled. Since the crypto/tls fix for golang/go#77274 (synced here in 23b5a72),QUICConn.Closewaits onsignalcaftercancel(), because cancellation is now processed only inside a user call.UQUICConn.Closewas not updated and still drainsblockedcright away, so the handshake goroutine never gets the signal it is waiting for andCloseblocks forever.2.
SetTransportParametersdoes not reach the peer when a preset is applied. The parameters were stored only inquic.transportParams, which a preset ClientHello does not use (the code had a commented-out loop for this). SinceApplyPresetclones the spec, theQUICTransportParametersExtensionthat gets marshaled is the clone, so callers cannot fix it from the outside either. The change stores the parameters in that extension.Both are covered by new tests in
u_quic_preset_test.go, modeled onTestUQUICDefaultMinVersionand Go'sTestQUICContextCancelation:TestUQUICPresetTransportParameters: without the change the server receives empty transport parameters;TestUQUICContextCancelation: without the change it hangs until the test timeout.With the change,
go test -race -run 'TestUQUIC|TestQUIC'and the fullgo testpass.