From be2e72e36e9230d4c2745beab8b2e754d100dd83 Mon Sep 17 00:00:00 2001 From: Christian Simon Date: Wed, 10 Apr 2024 17:01:49 +0100 Subject: [PATCH] Fix panic when dealing with missing mapping ID I have not gotten to the bottom of why the mapping ID is missing when maxNodes!=0. This is presenting a workaround until we full understand the issue. Fixes #3164 --- pkg/phlaredb/symdb/resolver_pprof_truncate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/phlaredb/symdb/resolver_pprof_truncate.go b/pkg/phlaredb/symdb/resolver_pprof_truncate.go index e80d36197a..0bda35c0c2 100644 --- a/pkg/phlaredb/symdb/resolver_pprof_truncate.go +++ b/pkg/phlaredb/symdb/resolver_pprof_truncate.go @@ -262,6 +262,10 @@ func createLocationStub(profile *googlev1.Profile) { SystemName: stubNodeNameIdx, } profile.Function = append(profile.Function, stubFn) + // in the case there is no mapping, we need to create one + if len(profile.Mapping) == 0 { + profile.Mapping = append(profile.Mapping, &googlev1.Mapping{Id: 1}) + } stubLoc := &googlev1.Location{ Id: uint64(len(profile.Location) + 1), Line: []*googlev1.Line{{FunctionId: stubFn.Id}},