Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 95cf3af

Browse files
authored
Merge pull request #339 from grafana/20221020_reproduce-profile-panics
Reproduce panicing python profile
2 parents f7c5e72 + bcbad79 commit 95cf3af

File tree

4 files changed

+99
-4
lines changed

4 files changed

+99
-4
lines changed

pkg/phlaredb/head_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,23 @@ func TestHeadIngestRealProfiles(t *testing.T) {
333333
profilePaths := []string{
334334
"testdata/heap",
335335
"testdata/profile",
336+
"testdata/profile_uncompressed",
337+
"testdata/profile_python",
336338
}
337339

338340
head := newTestHead(t)
339341
ctx := context.Background()
340342

341343
for pos := range profilePaths {
342-
profile := parseProfile(t, profilePaths[pos])
343-
require.NoError(t, head.Ingest(ctx, profile, uuid.New()))
344+
path := profilePaths[pos]
345+
t.Run(path, func(t *testing.T) {
346+
profile := parseProfile(t, profilePaths[pos])
347+
require.NoError(t, head.Ingest(ctx, profile, uuid.New()))
348+
})
344349
}
345350

346351
require.NoError(t, head.Flush(ctx))
347-
t.Logf("strings=%d samples=%d", len(head.strings.slice), len(head.profiles.slice[0].Samples))
352+
t.Logf("strings=%d samples=%d", len(head.strings.slice), head.totalSamples.Load())
348353
}
349354

350355
func BenchmarkHeadIngestProfiles(t *testing.B) {

pkg/phlaredb/locations.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ func (*locationsHelper) addToRewriter(r *rewriter, elemRewriter idConversionTabl
5353
}
5454

5555
func (*locationsHelper) rewrite(r *rewriter, l *profilev1.Location) error {
56-
r.mappings.rewriteUint64(&l.MappingId)
56+
// when mapping id is not 0, rewrite it
57+
if l.MappingId != 0 {
58+
r.mappings.rewriteUint64(&l.MappingId)
59+
}
5760

5861
for pos := range l.Line {
5962
r.functions.rewriteUint64(&l.Line[pos].FunctionId)
205 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)