perfetto icon indicating copy to clipboard operation
perfetto copied to clipboard

customized proto in track_event via debug annotation proto_type/proto_value may cause stringpool leak if unknown to trace_pocessor

Open aetheln opened this issue 6 months ago • 4 comments

in v55.2, trace_processor consumes debug annotation proto_value and tries to decoding, if the type is unknown, code core will return a failure status to the caller. for certain data streams, there is a change, after processing such cases, the processor's string pool will deplete and heat the 2G limitation in code. same data can be processed in previous released versions, seems the issue is related recent work-stack change (6fca04fc6689d55). if we change the status returing to success (just ignoring the unknwon items), the stringpool leak is gone.

aetheln avatar May 20 '26 01:05 aetheln

Could you please provide a trace demonstrating this issue? I'm not sure I understand what the problem is and an example would help far more than anything else.

LalitMaganti avatar May 20 '26 01:05 LalitMaganti

my example trace is too big to upload here :( but I can tell you what I did. I am using TRACK_EVENT to record certain data in our running system. basically the data is some local proto messages which is unknown to perfetto. we just wrapped a macro based on some form of TRACK_EVENT, and put the proto type name and proto data blob into debug annotation using its proto_value and proto_type_name/proto_type_name_iid。in my usage case, the proto messages has both big numbers (milliseconds level in density) and blob size (kB level each) and the trace has a duration of 15-30 minutes. I did a little debug and found when processor does not know the proto type, it returns a failure status, and in recent wokstack change, this 'return' has some nagative impact on the workstack loop and some how caused a leak in stringpool. during the debug I see longer and longer strings are put into the pool. in previous data_processor versions, the importer will success loding the trace data (known protos are simply ignored), but in v55.2, it began report stringpool full error and crash.

aetheln avatar May 20 '26 02:05 aetheln

Thanks for the clarification. That gives me enough to go off and I'm reasonably certain https://github.com/google/perfetto/pull/5873 fixes this issue.

We're probably going to release v56 in a couple of weeks and I don't think this meets the bar for a respin so this will likely have to wait unitl then.

LalitMaganti avatar May 20 '26 02:05 LalitMaganti

Will be closing this as the fix is in main already and v56 will be coming out next Wednesday and will include a fix for this issue.

LalitMaganti avatar May 28 '26 23:05 LalitMaganti