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,runtime: apparent deadlock in (*net.conn).Close and runtime.netpollblock on arm64 platforms [1.17 backport] #49010

Closed
gopherbot opened this issue Oct 15, 2021 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@prattmic requested issue #48925 to be considered for backport to the next 1.17 minor release.

@LaPingvino give the new version a try, though it sounds like you may be having a different issue. Logs would definitely help.

@gopherbot please backport to 1.17 and 1.16. This is a pre-existing issue with no workaround, and causing flakes on trybots.

@gopherbot
Copy link
Author

Change https://golang.org/cl/356369 mentions this issue: [release-branch.go1.17] runtime: consistently access pollDesc r/w Gs with atomics

@cherrymui
Copy link
Member

This is serious runtime issue. Approved for backport. Thanks.

@cherrymui cherrymui added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Oct 20, 2021
@gopherbot
Copy link
Author

Closed by merging 8bdb0b2 to release-branch.go1.17.

gopherbot pushed a commit that referenced this issue Oct 28, 2021
…with atomics

Both netpollblock and netpollunblock read gpp using a non-atomic load.
When consuming a ready event, netpollblock clears gpp using a non-atomic
store, thus skipping a barrier.

Thus on systems with weak memory ordering, a sequence like so this is
possible:

             T1                                T2

1. netpollblock: read gpp -> pdReady
2. netpollblock: store gpp -> 0

                                 3. netpollunblock: read gpp -> pdReady
                                 4. netpollunblock: return

i.e., without a happens-before edge between (2) and (3), netpollunblock
may read the stale value of gpp.

Switch these access to use atomic loads and stores in order to create
these edges.

For ease of future maintainance, I've simply changed rg and wg to always
be accessed atomically, though I don't believe pollOpen or pollClose
require atomics today.

For #48925
Fixes #49010

Change-Id: I903ea667eea320277610b4f969129935731520c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/355952
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 1b072b3)
Reviewed-on: https://go-review.googlesource.com/c/go/+/356369
@golang golang locked and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants