-
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
cmd/compile: race detector prints mis-leading stack trace #33309
Comments
I think the race detector traceback code isn't handling mid-stack inlining correctly. As far as I can tell, the race detector does its own stack traceback, then just asks the runtime to symbolize a bunch of pcs. It requests one pc at a time, and we can only give a single response to each pc. So there's no way to report multiple frames per pc. Kind of strangely, we report the function name of the outermost function, but the file/line of the innermost function (this kind of makes sense for profiling, but is weird in this situation). So if Dmitry, can you think of any way to fix this? Simple repro:
Generates
If I add a
|
To fix this one would need to extend the interface between tsan and Go runtime to be able to pass multiple frames. The tsan runtime supported multiple frames per PC from day one, so it's just a matter of extending the interface here: Updating the syso files may be a bit challenging. We don't do this regularly, so some things may get rotten. Not sure if racebuild is working today. |
…rames for a single PC This fix allows tsan to report stack traces correctly even in the presence of mid-stack inlining by the Go compiler. See golang/go#33309
Change https://golang.org/cl/195781 mentions this issue: |
CLs out for the fixes in both tsan and the runtime, so they can correctly exchange info about mid-stack inlining. I'm having trouble with racebuild. I seem to be able to run the steps manually, but just using racebuild itself fails in a strange way:
does a bunch of setup work (apt-get, ...), then fails with:
Why can't the trybots clone the go source code? It works fine on my machine, and if I |
Hmm. I have not used racebuild, so I'm not sure how it works.
For normal trybot runs, the Go repository and other golang.org/x repositories are not |
Ok, I think I see the problem in the code. Update: Read the last paragraph of this comment first.
I can send a CL to fix the problem. In the meantime, you can probably just patch racebuild locally to work around the problem with something like: -if _, err := p.Gomote(ctx, "run", "-e=REV="+*flagRev, "-e=GOREV="+goRev, p.Inst, targetName); err != nil {
+if _, err := p.Gomote(ctx, "run", "-e=REV="+*flagRev, "-e=GOREV="+goRev, "-e=GO_DISABLE_OUTBOUND_NETWORK=0", p.Inst, targetName); err != nil { The -e env vars are added after and thus take higher precedence. However, I'm noticing now that @randall77 Maybe the problem is your |
Reopening, still need to update the syso files. |
Change https://golang.org/cl/197337 mentions this issue: |
This code is not currently compiling, the asm vet checks fail. When running race.bash on ppc64le, I get: runtime/race_ppc64le.s:104:1: [ppc64le] RaceReadRange: wrong argument size 24; expected $...-16 runtime/race_ppc64le.s:514:1: [ppc64le] racecallbackthunk: unknown variable cmd; offset 0 is arg+0(FP) runtime/race_ppc64le.s:515:1: [ppc64le] racecallbackthunk: unknown variable ctx I'm also not sure why it ever worked; it looks like it is writing the arguments to racecallback in the wrong place (the race detector itself probably still works, it would just have trouble symbolizing any resulting race report). At a meta-level, we should really add a ppc64le/race builder. Otherwise this code will rot, as evidenced by the rot this CL fixes :) Update #33309 Change-Id: I3b49c2442aa78538fbb631a143a757389a1368fd Reviewed-on: https://go-review.googlesource.com/c/go/+/197337 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Change https://golang.org/cl/201898 mentions this issue: |
Change https://golang.org/cl/195984 mentions this issue: |
Add test to make sure we get the right traceback when mid-stack inlining. Update #33309 Change-Id: I23979cbe6b12fad105dbd26698243648aa86a354 Reviewed-on: https://go-review.googlesource.com/c/go/+/195984 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
(discovered while debugging golang/protobuf#838)
Consider the following
main.go
:When running
go run -race main.go
, I see (-go1.12 +go1.11):The interesting line is
/usr/local/protobuf-golang/jsonpb/jsonpb.go:534
, which is missing in the stack trace on Go1.12, presumably because of mid-stack inlining.The text was updated successfully, but these errors were encountered: