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

don't remove closed connections from the server's accept queue #4245

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

marten-seemann
Copy link
Member

In preparation for #3549.

This changes the connection queuing logic on the server side. So far, if the server is falling behind on Accepting new connections, we queue up to protocol.MaxAcceptQueueSize connections. Each of these connections has a Go routine watching for the connection to close, and removes this connection from the accept queue if it is closed for any reason.

I don't really see any reason to do it that way. First of all, the server should be able to keep with accepting connections, so at best this is an optimization for a corner case. Second, the server might be interested in learning why the connection was closed. It shouldn't make a difference if the connection was closed 1ms before or after it was accepted.

I hope to eventually get rid of the handleNewConn goroutine altogether. This will require figuring out what happens to these connections when the server is closed. As of v0.40.0, closing the server doesn't close the associated connections anymore: It's now the application's responsibility to deal with these connections. However, we do need to close the connections that weren't accepted yet, since they weren't passed to the application yet. I suspect the current code has a bug here, I don't see this condition being handled anywhere.

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (cb1775a) 84.08% compared to head (28c730d) 84.09%.

Files Patch % Lines
server.go 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4245   +/-   ##
=======================================
  Coverage   84.08%   84.09%           
=======================================
  Files         150      150           
  Lines       15403    15401    -2     
=======================================
- Hits        12951    12950    -1     
  Misses       1950     1950           
+ Partials      502      501    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marten-seemann marten-seemann added this to the v0.42 milestone Jan 17, 2024
@sukunrt sukunrt self-requested a review January 18, 2024 10:06
@marten-seemann marten-seemann merged commit 594440b into master Jan 19, 2024
34 checks passed
@marten-seemann marten-seemann deleted the server-accept-closed-connections branch January 19, 2024 07:01
nanokatze pushed a commit to nanokatze/quic-go that referenced this pull request Feb 1, 2024
mgjeong pushed a commit to mgjeong/quic-go that referenced this pull request Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants