Skip to content

net/http: Server closeIdleConns does not close StateNew connections #22682

@kcburge

Description

@kcburge

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.9.2

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

any (linux x86_64)

What did you do?

Long Story: my web app was not closing when calling Shutdown on my http server. Google Chrome for some reason was creating a couple new connections to my server, but not making any requests on them. I'm guessing this is for performance, but I couldn't find any explanation. These extra connections stay in "StateNew" state, so, Shutdown does not close them when closing idle connections.

Short Story: Tried to "Shutdown" http server with StateNew connections.

https://play.golang.org/p/dP4vQZkKdx

What did you expect to see?

Since StateNew is an idle state, I'd expect it to be closed during Shutdown.

What did you see instead?

Shutdown must be cancelled to clear StateNew connections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions