Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONNECTION_REFUSED errors are not sent out from the server #4251

Closed
marten-seemann opened this issue Jan 19, 2024 · 0 comments · Fixed by #4250
Closed

CONNECTION_REFUSED errors are not sent out from the server #4251

marten-seemann opened this issue Jan 19, 2024 · 0 comments · Fixed by #4250
Labels
Milestone

Comments

@marten-seemann
Copy link
Member

The server intends to send out CONNECTION_REFUSED errors to connection that are in the process of handshaking when it is closed:

quic-go/server.go

Lines 690 to 712 in b3eb375

func (s *baseServer) handleNewConn(conn quicConn) {
connCtx := conn.Context()
if s.acceptEarlyConns {
// wait until the early connection is ready, the handshake fails, or the server is closed
select {
case <-s.errorChan:
conn.destroy(&qerr.TransportError{ErrorCode: ConnectionRefused})
return
case <-conn.earlyConnReady():
case <-connCtx.Done():
return
}
} else {
// wait until the handshake is complete (or fails)
select {
case <-s.errorChan:
conn.destroy(&qerr.TransportError{ErrorCode: ConnectionRefused})
return
case <-conn.HandshakeComplete():
case <-connCtx.Done():
return
}
}

Unfortunately, this doesn't work: destroy destroys the connection without sending out a CONNECTION_CLOSE frame. We didn't have an integration test for this, so this went undetected for the longest time. Fortunately, this is a pretty rare situation, so it probably doesn't matter too much in production.

However, with #3549, we'll need to send CONNECTION_REFUSED in a lot more situations, so we might as well get things in order before tackling that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant