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.16 backport] #49009

Closed
gopherbot opened this issue Oct 15, 2021 · 3 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 15, 2021

@prattmic requested issue #48925 to be considered for backport to the next 1.16 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

@gopherbot gopherbot commented Oct 15, 2021

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

Loading

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Oct 20, 2021

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

Loading

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Oct 28, 2021

Closed by merging 8c9c148 to release-branch.go1.16.

Loading

@gopherbot gopherbot closed this Oct 28, 2021
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 #49009

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/+/356370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants