pkg/profile

10 byte profile file can't be opened

thnk2wn opened this issue · 7 comments

After profiling I get a 10 byte file (cpu.pprof.zip) that when read produces:

  • cpu.pprof: decompressing profile: unexpected EOF ( With go tool pprof cpu.pprof)
  • Unexpected end of ZLIB input stream (With Goland)

Tried both:

defer profile.Start(profile.ProfilePath(os.Getenv("HOME"))).Stop()

as well as:

p := profile.Start(profile.ProfilePath(os.Getenv("HOME")), profile.NoShutdownHook)
// ...
p.Stop()

As of 3704c8d on macOS Big Sur 11.1.

With the shutdown hook I saw the library was intercepting shutdown to stop profiling. Without it I see my code called to .Stop().

Troubleshooting ideas?

Thanks for your work.

How much work is your program doing between starting and stopping the profile?

@davecheney I ran the API app for about 5 minutes and made several requests over HTTP and web sockets that hit PostgreSQL, Elastic Search, Redis, 3rd party APIs, S3, etc.

Seems reasonable; how are you stopping the program, or the profile?

Can you reproduce the issue on a non big sur machine? Maybe try the trace profile not CPU profile. Perhaps pprof is broken on big sur

For my needs https://github.com/gin-contrib/pprof worked but can maybe look into this more later. Thanks

ok, no problem. I'll close this for the moment, please feel free to reopen it in the future.