-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: TCPConn.ReadFrom hangs when io.Reader is TCPConn or UnixConn, Linux kernel < 5.1 #63795
Comments
@sebastien-rosset Thanks for your efforts here. Although this problem was caused by the CL in #59041, that issue focused on another problem originally, therefore I asked to open a new issue for this problem solely, for tracking purposes. @gopherbot please consider this for backport to go1.21, it's a regression. |
Backport issue(s) opened: #63801 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/538117 mentions this issue: |
Thanks @sebastien-rosset, @panjf2000 . |
@panjf2000, was this fixed at HEAD in https://go.dev/cl/536015, or is there more to do for this for Go 1.22? |
My observation is:
|
This bug has been fixed by CL 536015 which would normally come after this issue, however the earliest bug report about this issue was filed in #59041 that focused on another problem originally and here we are, trying to tweak the process to the way it used to be, therefore there is nothing left out for this issue. I'm not so sure which way will make more sense: let CL 538117 close this issue automatically by adding |
@panjf2000, if this issue is already fixed at HEAD then let's go ahead and close it and use |
… splice to avoid inconsistency with O_NONBLOCK Fixes #63801 Updates #59041 Updates #63795 Details: #59041 (comment) Change-Id: Id3fc1df6d86b7c4cc383d09f9465fa8f4cc2a559 Reviewed-on: https://go-review.googlesource.com/c/go/+/536015 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> (cherry picked from commit 40cdf69) Reviewed-on: https://go-review.googlesource.com/c/go/+/538117 Auto-Submit: Heschi Kreinick <heschi@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
This is a regression from 1.20.x.
What operating system and processor architecture are you using (
go env
)?The problem can be reproduced when running the program on Linux with amd64 cpu architecture and kernel version < 5.1. We have reproduced the problem on the following systems:
For our tests, we did a cross-compilation so there was no go tool chain on the target system. But as a follow-up we should be able to reproduce the test without cross-compilation.
go env
OutputWhat did you do?
This is similar of issue #59041, but @panjf2000 asked to file a new issue.
We compiled and executed the following program with
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build .
It's not possible to reproduce the problem in go playground because the playground has Linux kernel > 5.1.
The program does the following:
What did you expect to see?
I expected the program to complete the data transfer successfully.
When running the program in a Linux environment with kernel 5.1 and above, the program produces the following output:
The program completes successfully if it has been compiled with go
master
after October 18th 2023. The fix is https://go-review.googlesource.com/c/go/+/536015.What did you see instead?
When the program has been compiled with go version 1.21.x (<= 1.21.3) AND it runs in a Linux environment with kernel < 5.1, the program produces the following output and hangs:
The program hangs in
TCPConn.ReadFrom()
, which invokes thesplice()
system call.We think it should be possible to create a simpler program that can reproduce the issue.
Looking at the git history of internal/poll/splice_linux.go, the issue also exists in all 1.21.x versions, though we haven't actually tested each patch version.
We are consistently running into this issue with golang.org/x/net@v0.0.17 (go 1.21.3) with a proxy server. The application communicates with a remote server through a goproxy. The transfer starts of normally and after a few seconds (and approximately 10MB of download), connection completely stalls. This is the stack trace of the goroutines that have stalled.
The text was updated successfully, but these errors were encountered: