google / perf_data_converter

Tool to convert Linux perf files to the profile.proto format used by pprof
BSD 3-Clause "New" or "Revised" License
303 stars 55 forks source link

perf_to_profile crashes on a 3GB perf.data file #141

Open kcalvinalvin opened 1 year ago

kcalvinalvin commented 1 year ago
perf record ./src/bitcoind -datadir=mainnet -server=0 -connect=127.0.0.1 -dbcache=16000

I ran the above command to capture a perf of a long running process (3-4 hours) and got the following error:

[libprotobuf FATAL external/com_google_protobuf/src/google/protobuf/stubs/stringpiece.cc:50] size too big: 18446744072542064660 details: string length exceeds max size
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  size too big: 18446744072542064660 details: string length exceeds max size
fish: Job 1, '../perf_data_converter/result/b…' terminated by signal SIGABRT (Abort)

The perf.data file generated by the perf was 3GB. It's too big to attach in the github issues but I can provide it on request.

EDIT: I just saw #123 and should mention that the binary I was using was built on b1c2b82a8ec75b016c36da31c845491c75b9adae

aalexand commented 1 year ago

Probably an integer overflow somewhere. I think to get the faster answer you would need to debug it yourself a bit - if you figure out the fix and it's trivial just send a PR and we'll review it.

gmarin13 commented 1 year ago

It could be a 32-bit signed integer extended to 64-bit. Note that the protobuf string piece has a max size of 1<<63 - 1.

18446744072542064660 = 0xFFFFFFFFBA699014 Taking the last 32 bits, 0xBA699014 = 3127480340 (~ 3 GB).

aalexand commented 1 year ago

Ah, good find, @gmarin13!