Skip to content

http3: immediately close all connections on Server.Close#4689

Merged
marten-seemann merged 2 commits intomasterfrom
http3-close-all-conns
Oct 9, 2024
Merged

http3: immediately close all connections on Server.Close#4689
marten-seemann merged 2 commits intomasterfrom
http3-close-all-conns

Conversation

@marten-seemann
Copy link
Copy Markdown
Member

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.76%. Comparing base (b223359) to head (6dd2d16).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
http3/server.go 66.67% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4689      +/-   ##
==========================================
- Coverage   84.77%   84.76%   -0.01%     
==========================================
  Files         150      150              
  Lines       14922    14929       +7     
==========================================
+ Hits        12650    12654       +4     
- Misses       1743     1745       +2     
- Partials      529      530       +1     

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

Comment thread http3/server.go
// ServeQUICConn serves a single QUIC connection.
func (s *Server) ServeQUICConn(conn quic.Connection) error {
return s.handleConn(conn)
return s.handleConn(context.Background(), conn)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. It will cause the quic connection to be shutdown. Users should coordinate this with the server shutdown, or not call shutdown at all.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a background context, so it's never canceled. This means that when users pass a connection to ServeQUICConn, closing the server will not the connection. It's the user's responsibility to close that connection.

@marten-seemann
Copy link
Copy Markdown
Member Author

This matches the behavior of HTTP/1.1: https://gist.github.com/marten-seemann/daaeb2949cdebd68d6c93381f6589c17. Closing the server kills the request.

@WeidiDeng
Copy link
Copy Markdown
Contributor

I tested your patch, but the response is successful. The test is inside the integration test. The OS is windows 10 amd64.

image

image

Any idea why?

@WeidiDeng
Copy link
Copy Markdown
Contributor

WeidiDeng commented Oct 9, 2024

server_test is using a mock quic stream, but http_test is using a real quic stream. This shouldn't affect how the quic works, right?

@marten-seemann
Copy link
Copy Markdown
Member Author

I tested your patch, but the response is successful. The test is inside the integration test. The OS is windows 10 amd64.

image

image

Any idea why?

Because it needs #4689.

@WeidiDeng
Copy link
Copy Markdown
Contributor

I added some of your changes though.

image

image

The first line is the debug output

@WeidiDeng
Copy link
Copy Markdown
Contributor

I see what's going on here. But I fixed it already.

@marten-seemann
Copy link
Copy Markdown
Member Author

@WeidiDeng Let's merge this PR, then you can rebase #4669.

@WeidiDeng
Copy link
Copy Markdown
Contributor

I actually removed the new context parameter. I feel like my change just overwrites yours.

@marten-seemann
Copy link
Copy Markdown
Member Author

I actually removed the new context parameter. I feel like my change just overwrites yours.

We can deal with this on your PR. This PR is correct in and of itself, and we need a very similar behavior for graceful shutdown (once the context expires).

@marten-seemann marten-seemann merged commit e5693d0 into master Oct 9, 2024
@marten-seemann marten-seemann deleted the http3-close-all-conns branch October 12, 2024 04:49
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.

2 participants