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

runtime: race detector SIGABRT or SIGSEGV on macOS Monterey [1.17 backport] #50073

Closed
gopherbot opened this issue Dec 9, 2021 · 6 comments
Closed
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@cherrymui requested issue #49138 to be considered for backport to the next 1.17 minor release.

@gopherbot please open a backport of this for Go 1.16 and 1.17 releases. Thanks.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Dec 9, 2021
@gopherbot gopherbot added this to the Go1.17.6 milestone Dec 9, 2021
@cherrymui
Copy link
Member

We thought about using a different way of workaround for backports, namely setting the environment variable MallocNanoZone=0 automatically in go run -race and go test -race, which minimizes the changes for pre-macOS 12 systems. But when I tried it I found that there are a fair number of tests that creates subprocesses without preserving the environment, which makes the environment variable workaround ineffective. And there are probably similar cases in user codebase as well.

So we think we'll go with a plain backport of CL https://go-review.googlesource.com/c/go/+/367916/ instead. The syso (before that CL) are the same for Go 1.16, 1.17, and tip. So this would not include unrelated changes in LLVM TSAN for previous releases.

@gopherbot
Copy link
Author

Change https://golang.org/cl/370697 mentions this issue: [release-branch.go1.17] runtime/race: rebuild darwin syso to work around macOS 12 malloc reserved address

@creachadair
Copy link

Based on this and the linked issue, is it accurate to say that a source build of Go 1.17.5 on macOS Monterey is not practical until 1.17.6?

@cherrymui
Copy link
Member

@creachadair I'm not sure I understand what you mean by "a source build". You can build the Go toolchain from source or use Go to build your program on macOS 12 just fine, just either not use the race detector, or set the environment variable MallocNanoZone=0 when running a program built with the race detector.

@creachadair
Copy link

creachadair commented Dec 9, 2021

@creachadair I'm not sure I understand what you mean by "a source build". You can build the Go toolchain from source or use Go to build your program on macOS 12 just fine, just either not use the race detector, or set the environment variable MallocNanoZone=0 when running a program built with the race detector.

I see. I built from source using all.bash but some test cases failed due to this error. I suppose I could ignore the test failure (or maybe set that environment variable). Thanks for the clarification.

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

Closed by merging 59f1a26 to release-branch.go1.17.

gopherbot pushed a commit that referenced this issue Dec 22, 2021
…und macOS 12 malloc reserved address

On macOS 12 a new malloc implementation (nano) is used by default,
and apparently it reserves address range
0x600000000000-0x600020000000, which conflicts with the address
range that TSAN uses for Go. Work around the issue by changing the
address range slightly.

The actual change is made on LLVM at https://reviews.llvm.org/D114825 .
This CL includes syso's built with the patch applied.

The syso in 1.17 was identical to the syso before the equivalent fix
on the main branch, so the back-ported syso is identical to the fixed
syso on the main branch.

Fixes #50073.
Updates #49138.

Change-Id: I7b367d6e042b0db39a691c71601c98e4f8728a70
Reviewed-on: https://go-review.googlesource.com/c/go/+/367916
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
(cherry picked from commit 5f65520)
Reviewed-on: https://go-review.googlesource.com/c/go/+/370697
@golang golang locked and limited conversation to collaborators Dec 22, 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

3 participants