question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CPU Profile not parseable by pprof

See original GitHub issue

Latest pprof can not parse the output of the com.twitter.jvm.CpuProfile class, most likely because CpuProfile produces a legacy profile that became unsupported when pprof was reimplemented in Go.

Actual Behavior

With pprof from “go get -u github.com/google/pprof” at a74ae6fb3cd7047c79272e3ea0814b08154a2d3c and running on Mac OS El Capitan, I produced a profile from my server that looks like that following:

--- symbol
binary=com.yext.profileservice.ProfileServer
0x0000000000000001 com.yext.rpc.RpcServer$Worker.run(RpcServer.java:356)
0x0000000000000002 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
0x0000000000000003 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
...
---
--- profile
^@^@^@^@^@^@^@^@^C^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^A^@^@^@^@^@^@^@^F^@^@^@^@^@^@^@^A^@^@^@^@^@^@^@^B^@^@^@^@
...

Full file here: https://github.com/robfig/testprofile/blob/master/legacy_profile

Trying to feed that to pprof is unsuccessful

$ pprof profile
legacy_profile: parsing profile: unrecognized profile format
pprof: failed to fetch any source profiles

Expected behavior

I expected pprof to accept the profile.

I believe you can reproduce using any profile produced by this class with latest pprof.

Any advice would be much appreciated. I’m afraid that fixing this requires updating to use the protobuf profile format though.

Thanks very much, Rob

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mariusaecommented, Apr 5, 2018

Ooof. I don’t think we’d want to take a dependency on protobuf for this functionality. Perhaps that dependency could be added in a separate module that you’d have to opt into

fwiw, they didn’t want this dependency in Go, either, and just wrote manual code to encode the profiles. it’s not too bad.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to get data from CPU profiling - Stack Overflow
For me, the problem was my code was executing too fast. What I did is changing the sampling rate using runtime.SetCPUProfileRate.
Read more >
Debugging Syncthing — Syncthing v1.19.2 documentation
Write a CPU profile to cpu-$pid.pprof on exit. STDEADLOCKTIMEOUT ... If missing or not parseable, the default value of 1 month is used....
Read more >
Syncthing - Ubuntu Manpage
STCPUPROFILE Write a CPU profile to cpu-$pid.pprof on exit. STDEADLOCKTIMEOUT Used for debugging internal deadlocks; sets debug sensitivity.
Read more >
runtime/pprof - Go Packages
The CPU profile is not available as a Profile. It has a special API, the StartCPUProfile and StopCPUProfile functions, because it streams output...
Read more >
pprof++: A Go Profiler with Hardware Performance Monitoring
While the built-in Go profiler is better than having no profiler compared ... Unfortunately, the current pprof CPU profiles meet neither of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found