grafana / grafana/pyroscope

panic: runtime error: index out of range in pyroscope/pkg/util/loser.(*Tree[...]).Winner(...)

Open
#3,917 4 comments 0 reactions 0 assignees View on GitHub
storage type/bug v1
Dominant language
Go
Stars
11.7k
Forks
802
Avg merge
1d 19h
Merged PRs (30d)
80

Description

#### Describe the bug
pyroscope_1 | panic: runtime error: index out of range [-1]
pyroscope_1 |
pyroscope_1 | goroutine 2007 [running]:
pyroscope_1 | github.com/grafana/pyroscope/pkg/util/loser.(*Tree[...]).Winner(...)
pyroscope_1 | github.com/grafana/pyroscope/pkg/util/loser/tree.go:99
pyroscope_1 | github.com/grafana/pyroscope/pkg/iter.(*TreeIterator[...]).Err(0x10?)
pyroscope_1 | github.com/grafana/pyroscope/pkg/iter/tree.go:25 +0x4d
pyroscope_1 | github.com/grafana/pyroscope/pkg/parquet.(*IteratorRowReader).ReadRows(0xc128eefbe0, {0xc024c19c08, 0x40, 0xc0029dd440?})
pyroscope_1 | github.com/grafana/pyroscope/pkg/parquet/row_reader.go:86 +0x172
pyroscope_1 | github.com/grafana/pyroscope/pkg/parquet.CopyAsRowGroups({0x3878b88, 0xc07db0bb60}, {0x386f920, 0xc128eefbe0}, 0x186a0)
pyroscope_1 | github.com/grafana/pyroscope/pkg/parquet/row_writer.go:32 +0xea
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*profileStore).writeRowGroups(0xc031236b40, {0xc10592edc0?, 0x4f31140?}, {0xc0029dd350, 0x3, 0x484302d8?})
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/profile_store.go:383 +0x21a
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*profileStore).Flush(0xc031236b40, {0x3888f10, 0x4f31140})
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/profile_store.go:186 +0x317
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*Head).flush(0xc084d24140, {0x3888f10, 0x4f31140})
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/head.go:563 +0x234
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*Head).Flush(0xc084d24140, {0x3888f10, 0x4f31140})
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/head.go:540 +0xd9
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*PhlareDB).Flush.func1(0xc084d24140, 0x7f8509a673c8?)
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/phlaredb.go:240 +0xb4
pyroscope_1 | github.com/samber/lo.Filter[...]({0xc10def6b00, 0x1, 0x7}, 0xc018bcbde0?)
pyroscope_1 | github.com/samber/lo@v1.38.1/slice.go:15 +0x9f
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*PhlareDB).Flush(0xc003ddeb40, {0x3888f10, 0x4f31140}, 0x0, {0x28a5490, 0xc})
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/phlaredb.go:238 +0x932
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb.(*PhlareDB).loop(0xc003ddeb40)
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/phlaredb.go:188 +0x28f
pyroscope_1 | created by github.com/grafana/pyroscope/pkg/phlaredb.New in goroutine 1883
pyroscope_1 | github.com/grafana/pyroscope/pkg/phlaredb/phlaredb.go:137 +0x476

#### To Reproduce
Steps to reproduce the behavior:

Don't know, didn't investigate that much.

#### Expected behavior

No panic.

#### Environment

- Infrastructure: bare-metal, docker on Linux 3.10.0-1062.9.1.el7.x86_64 CentOS Linux 7
- Deployment tool: docker-compose

#### Additional Context

Pyroscope verison is grafana/pyroscope:1.12.0 run with -target=all. Mostly standard configuration (beside limits), using s3 as data store.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.