Skip to content

Parca crashes if the agent sends a stackframes write with empty filenames.  #5246

Open

Description

@umanwizard

To repro: apply this diff to latest main of parca-agent:

diff --git a/reporter/parca_reporter.go b/reporter/parca_reporter.go
index 52d1cd2c..d2535e74 100644
--- a/reporter/parca_reporter.go
+++ b/reporter/parca_reporter.go
@@ -804,7 +804,8 @@ func (r *ParcaReporter) buildStacktraceRecord(ctx context.Context, stacktraceIDs
 				w.LineNumber.Append(int64(0))
 				w.FunctionName.AppendString(symbol)
 				w.FunctionSystemName.AppendString("")
-				w.FunctionFilename.AppendString("vmlinux")
+				// w.FunctionFilename.AppendString("vmlinux")
+				w.FunctionFilename.AppendString("")
 				w.FunctionStartLine.Append(int64(0))
 			case libpf.AbortFrame:
 				// Next step: Figure out how the OTLP protocol

Then run it against local Parca. Parca crashes with this message:

panic: arrow/array: index out of range

goroutine 11552 [running]:
github.com/apache/arrow/go/v16/arrow/array.(*Binary).Value(0x400a24b5c0, 0x0)
        /home/brennan/go/pkg/mod/github.com/apache/arrow/go/v16@v16.1.0/arrow/array/binary.go:56 +0x174
github.com/parca-dev/parca/pkg/profile.serializedArrowLocationSize(0x3b30f3, 0x1, 0x0, 0x0, 0x0, {0x400022b577, 0x11, 0x49}, {0x0, 0x0, ...}, ...)
        /home/brennan/code/parca/pkg/profile/encode.go:397 +0x2b8
github.com/parca-dev/parca/pkg/profile.EncodeArrowLocation(0x3b30f3, 0x1, 0x0, 0x0, 0x0, {0x400022b577, 0x11, 0x49}, {0x0, 0x0, ...}, ...)
        /home/brennan/code/parca/pkg/profile/encode.go:296 +0xec
github.com/parca-dev/parca/pkg/normalizer.(*arrowToInternalConverter).AddLocationsRecordV1(0x400a275830, {0x6fd5148, 0x400a23a700}, {0x6ffbe70, 0x400a2963f0})
        /home/brennan/code/parca/pkg/normalizer/arrow.go:587 +0x19fc
github.com/parca-dev/parca/pkg/normalizer.(*arrowToInternalConverter).AddLocationsRecord(0x400a275830, {0x6fd5148, 0x400a23a700}, {0x6ffbe70, 0x400a2963f0})
        /home/brennan/code/parca/pkg/normalizer/arrow.go:130 +0x168
github.com/parca-dev/parca/pkg/profilestore.(*ProfileColumnStore).write(0x4001a1fda0, {0x6fd5148, 0x400a23a700}, {0x6fed460, 0x400a1db790})
        /home/brennan/code/parca/pkg/profilestore/profilecolumnstore.go:270 +0xfe4
github.com/parca-dev/parca/pkg/profilestore.(*ProfileColumnStore).Write.func1()
        /home/brennan/code/parca/pkg/profilestore/profilecolumnstore.go:180 +0x5c
created by github.com/parca-dev/parca/pkg/profilestore.(*ProfileColumnStore).Write in goroutine 11551
        /home/brennan/code/parca/pkg/profilestore/profilecolumnstore.go:179 +0x1e8

Activity

  1. changed the title [-]Parca crashes if the agents sends a stackframes write with empty filenames. [/-] [+]Parca crashes if the agent sends a stackframes write with empty filenames. [/+] on Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions