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: ServeContent()/ServeFile() doesn't return expected response when WriteTimeout happens [1.15 backport] #44294

gopherbot opened this issue Feb 16, 2021 · 3 comments


Copy link

@gopherbot gopherbot commented Feb 16, 2021

@odeke-em requested issue #43822 to be considered for backport to the next 1.15 minor release.

As per the comment by Ian in #43822 (comment), this issue is a worthy candidate. @gopherbot please backport this issue.

Copy link

@toothrot toothrot commented Feb 25, 2021

Approved. This is a serious issue with no workaround.

Copy link

@gopherbot gopherbot commented Feb 25, 2021

Change mentions this issue: [release-branch.go1.15] internal/poll: netpollcheckerr before sendfile

Copy link

@gopherbot gopherbot commented Feb 26, 2021

Closed by merging 30357d6 to release-branch.go1.15.

@gopherbot gopherbot closed this Feb 26, 2021
gopherbot pushed a commit that referenced this issue Feb 26, 2021
In net/http package, the ServeContent/ServeFile doesn't check the I/O
timeout error from chunkWriter or *net.TCPConn, which means that both
HTTP status and headers might be missing when WriteTimeout happens. If
the poll.SendFile() doesn't check the *poll.FD state before sending
data, the client will only receive the response body with status and
report "malformed http response/status code".

This patch is to enable netpollcheckerr before sendfile, which should
align with normal *poll.FD.Write() and Splice().

For #43822
Fixes #44294

Change-Id: I32517e3f261bab883a58b577b813ef189214b954
Reviewed-by: Emmanuel Odeke <>
Trust: Emmanuel Odeke <>
Trust: Bryan C. Mills <>
Run-TryBot: Emmanuel Odeke <>
(cherry picked from commit f0d23c9)
Trust: Ian Lance Taylor <>
Run-TryBot: Ian Lance Taylor <>
TryBot-Result: Go Bot <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants