-
Notifications
You must be signed in to change notification settings - Fork 592
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
pprof: ignores symbols in symbolized profile with no mappings #120
Comments
This reverts the revert of google#111 relaxing the test to make it pass as the issue reported in google#111 is caused by unrelated google#120. Added a test, verified the test failed before the fix. This fixes google#94.
The profile coming from the 1.8 handler on OSX is unsymbolized and has no mappings. Can somebody from the Go distro take a look? |
After cherry-picking https://go-review.googlesource.com/34192 Filed golang/go#19786 |
I assume @aalexand tried this on a linux system that was using a patched version. |
@rauls5382 I don't understand your comment. I originally reported this issue in #111 and I was definitely using stock toolchains in both Linux and Darwin. |
Yes, the issue is on all platforms. The comment from @aalexand at the beginning of this issue suggests that this only happens on OSX, but that appears not to be the case. |
I mean, that's nice, but it's factually incorrect. The problem does not occur on Linux on Go 1.8. I think this should be reopened and investigated more deeply. |
I see. I saw your comment on #111 thinking that this reproduced on both, but you were referring to the original issue, not the symbolization failure. From @aalexand investigation seems the difference is that the OSX profile has no mappings, so pprof cannot symbolize it. Moving forward we want online symbolization in Go anyway, but it may be worth opening an issue against go about they not having mappings on OSX -- those will be useful to symbolize non-Go symbols offline. |
Great, thanks for that. Could you mention that issue when you've filed it? |
I see. OSX is still missing the mappings section with Go tip. (pprof) raw PeriodType: cpu nanoseconds Period: 100000 Time: 2017-03-30 12:10:20.33628219 -0400 EDT Duration: 5.19 Samples: samples/count cpu/nanoseconds 436 43600000: 1 2 3 1 100000: 4 1 100000: 5 6 7 8 Locations 1: 0x12dc6e0 main.run /Users/hakim/scratch/server.go:10 s=0 2: 0x12dc729 main.main /Users/hakim/scratch/server.go:18 s=0 3: 0x102d6d4 runtime.main /Users/hakim/go/src/runtime/proc.go:185 s=0 4: 0x12d42f8 runtime/pprof.profileWriter /Users/hakim/go/src/runtime/pprof/pprof.go:706 s=0 5: 0x105c5c6 runtime.usleep /Users/hakim/go/src/runtime/sys_darwin_amd64.s:323 s=0 6: 0x1037775 runtime.sysmon /Users/hakim/go/src/runtime/proc.go:3741 s=0 7: 0x103090d runtime.mstart1 /Users/hakim/go/src/runtime/proc.go:1162 s=0 8: 0x10307e3 runtime.mstart /Users/hakim/go/src/runtime/proc.go:1132 s=0 Mappings |
@hyangah can you file a Go bug for this? Or I can do it - LMK, want to make sure we don't race. |
Yes, I can. Clearly, https://github.com/golang/go/blob/master/src/runtime/pprof/proto.go#L370 is not for osx. |
I think go 1.7 generated the profile in a legacy format - https://github.com/golang/go/blob/go1.7.4/src/runtime/pprof/pprof.go#L683, and that has special handling for when there aren't any mappings - pprof/profile/legacy_profile.go Line 240 in 5c63cc7
In #89 there was a workaround added by @rauls5382 to create a fake mapping for non-legacy (i.e. proto) profiles as well but only when there is a binary explicitly specified on the command line. We could probably add the fake mapping if the profile source is remote but this seems a fragile hack. |
Indeed, 1.8 removed the legacy format: golang/go@76f12cd |
So uh, time to reopen this? |
@tamird and @rauls5382, I've confirmed that the current pprof (what you get from So @tamird, you should use 'go tool pprof' instead of 'pprof', and @rauls5382, you may want to fix / reassign this. First window:
Second window. Go tool pprof works:
but current github.com/google/pprof does not:
Dropping -symbolize=remote does not change the behavior. |
https://github.com/golang/go/blob/release-branch.go1.8/src/cmd/pprof/pprof.go vs So, go1.8 pprof uses symbolz.Symbolize if --symbolize is remote, "", or force. @rauls5382, is it not possible to fall back to symbolz? |
@rauls5382, do you plan to look at this issue? Feel free to unassign if not. |
Apologies for the long latency. In profile.proto the samples that came from a single binary are grouped together through the mapping. It would be good if the Go runtime would generate a mapping for the samples and associate them to the binary (the result of os.Executable()). That would relieve the user from having to pass the name of the binary to pprof for offline symbolization. More generally, the mappings would be useful for a handler returning profiles with samples from two different binaries, for example for cross-language support. pprof relies on the mappings to drive symbolization. It creates a single mapping for the legacy Go profiles. I was hoping to avoid doing that when handling profile.proto profiles, but we already do it in some cases if there are no mappings. I'll send shortly a commit to do this all the time, which will resolve the problem. @rsc, would you consider adding mappings to the profiles generated in Go? Even if some of the fields aren't meaningful on some platforms, the mapping still has value. This may be moot with online symbolization in Go, but it may still prove valuable for cross-language support. |
If a profile has mappings but no profiles, pprof may be unable to symbolize it offline, as it uses the mappings to keep track of which locations need symbolization. This fixes google#120
If a profile has mappings but no profiles, pprof may be unable to symbolize it offline, as it uses the mappings to keep track of which locations need symbolization. This fixes google#120. Added the test, verified it fails on Mac with Go 1.7 before the fix, and passes with the fix. The test is done by augmenting the existing test for handling https+insecure:// schema in URLs. This is a bit vague but I figured that this test needed an updated anyway since as we moved it recently we stopped exercising the symbolization as part of the test which was its original intention in fixing google#94. Can split the tests if things do look too ugly.
* Create a fake mapping for profile.proto profiles If a profile has mappings but no profiles, pprof may be unable to symbolize it offline, as it uses the mappings to keep track of which locations need symbolization. This fixes #120. Added the test, verified it fails on Mac with Go 1.7 before the fix, and passes with the fix. The test is done by augmenting the existing test for handling https+insecure:// schema in URLs. This is a bit vague but I figured that this test needed an updated anyway since as we moved it recently we stopped exercising the symbolization as part of the test which was its original intention in fixing #94. Can split the tests if things do look too ugly. * Fix the test to include the failed regex matching error in the message.
* Create a fake mapping for profile.proto profiles If a profile has mappings but no profiles, pprof may be unable to symbolize it offline, as it uses the mappings to keep track of which locations need symbolization. This fixes google#120. Added the test, verified it fails on Mac with Go 1.7 before the fix, and passes with the fix. The test is done by augmenting the existing test for handling https+insecure:// schema in URLs. This is a bit vague but I figured that this test needed an updated anyway since as we moved it recently we stopped exercising the symbolization as part of the test which was its original intention in fixing google#94. Can split the tests if things do look too ugly. * Fix the test to include the failed regex matching error in the message.
The issue was noticed in #111.
Test server:
Running it as
go run server.go
and profiling as "pprof -symbolize=remote localhost:6060/debug/pprof/profile?seconds=5" produces unknown symbol on OSX with Go 1.8. Doing the same with Go 1.7.5 produces correctly symbolized output.Looking at "-raw" output for the Go 1.8 vs. 1.7.5 profiles, there is a difference in the mapping section:
with Go 1.8 vs.
with Go 1.7.5.
Doing the same on Linux, produces
and
respectively that are both correctly symbolized profiles.
The text was updated successfully, but these errors were encountered: