Conversation
The pprof writer indexed empty Arrow dictionaries for null mapping fields and emitted lines with function ID zero for absent function metadata. This made full-profile exports panic or return invalid pprof data. Preserve available metadata, omit unrepresentable lines, and cover null fields with and without populated peer rows.
Author
|
@parca-dev/backend-maintainers Could a maintainer approve the fork workflows and review this fix? The local package tests, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The pprof writer assumes that mapping and function dictionary fields are always populated.
index out of range [0] with length 0.0, but the writer still emits a line that refers to that ID. The resulting pprof is invalid.We found these cases through Polar Signals Cloud's merged pprof export. Native gRPC and grpc-web showed the same results. The input profiles are valid before the Arrow round trip.
Change
Read each optional mapping and function field only when it is present. Create a function from any available function metadata. When no function metadata exists, keep the location and address but omit the line, because pprof cannot represent a line without a function.
The table test covers each nullable mapping and function field with both an empty dictionary and a populated peer row. It checks sample values, labels, addresses, mappings, lines, and available symbols after serialization and parsing.
Validation
go test ./pkg/profile ./pkg/query -count=1go vet ./pkg/querymake go/lint(0 issues)git diff --checkAll pass.