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

net/http: idle timeout added in CL 121419 is undocumented and surprising #59037

Open
bcmills opened this issue Mar 14, 2023 · 1 comment
Open
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

CL 121419 changed net/http.Server to treat new connections as idle after 5 seconds, in order to unblock Shutdown with stalled connections (see #22682). That behavior has a regression test, but I find it surprising and I don't see it mentioned in the net/http documentation at all.

I would intuitively expect one of two other behaviors:

  1. closeIdleConns could use the configured ReadHeaderTimeout for this purpose, as suggested in net/http: Server closeIdleConns does not close StateNew connections #22682 (comment).
  2. A call to Shutdown could instead cause closeIdleConns to close all connections in StateNew, regardless of how long they have been in that state.

(attn @neild; CC @bradfitz @tombergan)

@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
@dany74q
Copy link

dany74q commented Oct 14, 2024

Throwing this to the discussion: https://groups.google.com/g/golang-nuts/c/G6Ct8kzZiRU

I believe the first proposed option makes sense - it is a breaking change to existing clients,
so I might consider taking the max between 5 seconds / ReadHeaderTimeout, or maybe wrapping
w/ a godebug flag to allow back compat.

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

3 participants