Skip to content

net/http: HTTP/2 server sometimes accepts a new request after OnShutdown hook is called #59038

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

Open
bcmills opened this issue Mar 14, 2023 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Mar 14, 2023

When I modified net/http.TestServerShutdown to make a call to Get in the handler after the hook passed to RegisterOnShutdown was called, it passed reliably on my workstation but failed on the windows-amd64-2016 builder:

https://storage.googleapis.com/go-build-log/8141c27e/windows-amd64-2016_0b21b774.log:

--- FAIL: TestServerShutdown (0.00s)
    --- FAIL: TestServerShutdown/h2 (1.12s)
        serve_test.go:5478: https://127.0.0.1:51794: unexpected success. Listener should be closed before OnShutdown is called.
FAIL
FAIL	net/http	4.111s

That suggests that an HTTP/2 server (at least on Windows) may accept a completely new request after it has already called the OnShutdown hook. Even given HTTP/2's stream multiplexing, that behavior is surprising.

See previously #39776,

(attn @neild)

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 14, 2023
@bcmills bcmills added this to the Backlog milestone Mar 14, 2023
@bcmills
Copy link
Contributor Author

bcmills commented Feb 2, 2024

This might be a port-reuse bug: perhaps the server from TestServerShutdown/h2 did, in fact, already close its Listener, and some other test (in the same process or a different one) happened to open a new listener on the same port before the test tried to send that last request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

1 participant