Skip to content

http server.headersTimeout keeps the socket open after timeout #26165

@mariusgrigaitis

Description

@mariusgrigaitis
  • Version: v11.6.0
  • Platform: Darwin Mariuss-MBP-2.lan 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
  • Subsystem: http

In case timeout is reached for server.headersTimeout, node keeps the socket open until it receives data or server.timeout is reached.

I believe this issue causes dropped connections / 502 errors on AWS ALB (load balancer), because it tries to send data and socket closes immediately after data is received.

I have set server.headersTimeout = 10 * 1000 and ran tcpdump to confirm.

image

As you can see in the dump, 24 seconds has passed, data was received, acknowledged and socket closed after data was received.

I expected socket to be closed after 10 seconds has passed without data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions