-
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
runtime: "morestack on g0" in TestSegv on darwin-amd64 builders #39457
Comments
On darwin/amd64, to work around a kernel issue we rewrite SI_USER SIGEGV to kernel-generated: https://tip.golang.org/src/runtime/signal_darwin_amd64.go#L72 . So, in this case, an actual user-sent SIGSEGV will be treated as kernel-generated signal, and cause it to inject a sigpanic. If the signal lands at a bad time, e.g. we're right in the middle of a stack switch, where the g and the stack don't match, bad things will happen. I'm not sure what the best solution is. A few possibilities:
Not sure what to do with PanicOnFault. Due to the kernel issue, it seems we cannot distinguish malformed address vs. user-sent SIGSEGV. We have to make both recoverable or non-recoverable... (The workaround was added for OS X 10.9. The kernel issue seems still there for macOS 10.15...) |
Another possibility: when switching from user stack to system stack (e.g. in systemstack, asmcgocall, etc.), we always do (1) set user g's |
Hmm... Why do we ignore user-generated |
We don't ignore user-generated The test failure logs suggest that the problem is that we somehow think that we are out of stack space while handling a signal. I'm not sure how that could happen. |
In my experience, "morestack on g0" is usually not we are actually running out of stack space on g0, but somehow the SP and and the G (and so the stack bounds) don't match. My comment above mentioned some possibilities, e.g. signal lands right in the middle of a stack switch. As @ianlancetaylor said, we don't ignore user-generated SIGSEGV (we did it in the past, but not now). The specialness of darwin is that we treat user-generated SIGSEGV (which should crash the runtime) as kernel-generated (which causes a panic), due to a kernel bug ( https://tip.golang.org/src/runtime/signal_darwin_amd64.go#L72 ). Because of that, we inject a |
If the behavior covered by this test is important then we really ought to find a solution for it; otherwise, the test should be skipped to reduce noise on the builders. |
Change https://golang.org/cl/382395 mentions this issue: |
This failure mode has been present since at least 2020-06-08. We have enough information to diagnose it, and further failures don't seem to be adding any new information at this point: they can only add noise, both on the Go project's builders and in users' own modules (for example, when run as part of 'go test all'). For #39457 Change-Id: I2379631da0c8af69598fa61c0cc5ac0ea6ba8267 Reviewed-on: https://go-review.googlesource.com/c/go/+/382395 Trust: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
I have a user report about this error on a Windows machine with esbuild, which is written in Go but doesn't use cgo: evanw/esbuild#2031. I searched and found this issue and that report seemed potentially related, so I'm posting about it here in case it helps. |
@evanw that looks like a different issue. Could you open a new issue? Thanks. This issue is very specific to darwin (macOS) when a program receives an external SIGSEGV signal (e.g. by |
2020-06-08T17:59:37-2603d9a/darwin-amd64-race
CC @aclements @ianlancetaylor @cherrymui
The text was updated successfully, but these errors were encountered: