Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querier Panic - index out of range [2] with length 2 #8128

Open
Setheck opened this issue Feb 25, 2025 · 1 comment
Open

Querier Panic - index out of range [2] with length 2 #8128

Setheck opened this issue Feb 25, 2025 · 1 comment

Comments

@Setheck
Copy link

Setheck commented Feb 25, 2025

Thanos, Prometheus and Golang version used:
thanos container 0.37.2 deployed from helm 15.9.2

Object Storage Provider:
s3

What happened:
Query service seemed to panic out of nowhere

What you expected to happen:
Not to panic.

How to reproduce it (as minimally and precisely as possible):
unsure, this seems like a simple range check error

Full logs to relevant components:

Logs

2025/02/24 18:52:57 http: panic serving 127.0.0.1:51276: runtime error: index out of range [2] with length 2
goroutine 727734 [running]:
net/http.(*conn).serve.func1()
	/opt/bitnami/go/src/net/http/server.go:1947 +0xbe
panic({0x29d7060?, 0xc001df18d8?})
	/opt/bitnami/go/src/runtime/panic.go:785 +0x132
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.AnalyzesMerge({0xc0018fef90, 0x2, 0x2})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/query_range.go:239 +0x12a
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.prometheusCodec.MergeResponse({}, {0x4788bf?, 0x20?}, {0xc001ebf200, 0x2, 0x2})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/query_range.go:282 +0x5ce
github.com/thanos-io/thanos/pkg/queryfrontend.downsampled.Do({{0x39b8700, 0xc00096b6c0}, {0x39b87e0, 0xc0001a0b10}, {0x39e3438, 0xc0010e46c0}}, {0x39d9f18, 0xc001e7a4e0}, {0x39f7be0, 0xc001dd3a00})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/pkg/queryfrontend/downsampled.go:89 +0x32a
github.com/thanos-io/thanos/pkg/queryfrontend.newQueryRangeTripperware.InstrumentMiddleware.func5.1.1({0x39d9f18?, 0xc001e7a4e0?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/instrumentation.go:31 +0x43
github.com/weaveworks/common/instrument.CollectedRequest({0x39d9f18, 0xc001e7a4b0}, {0x2ba80b0, 0xb}, {0x39d0a08, 0xc000966970}, 0xc000100008?, 0xc0009ca3d0)
	/bitnami/blacksmith-sandox/thanos-0.37.2/pkg/mod/github.com/weaveworks/[email protected]/instrument/instrument.go:167 +0x25d
github.com/thanos-io/thanos/pkg/queryfrontend.newQueryRangeTripperware.InstrumentMiddleware.func5.1({0x39d9f18?, 0xc001e7a4b0?}, {0x39f7be0?, 0xc001dd3a00?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/instrumentation.go:29 +0x96
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.HandlerFunc.Do(0xc001dd3900?, {0x39d9f18?, 0xc001e7a4b0?}, {0x39f7be0?, 0xc001dd3a00?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/roundtrip.go:86 +0x37
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.stepAlign.Do({{0x39b8700?, 0xc00096b7c0?}}, {0x39d9f18, 0xc001e7a4b0}, {0x39f7be0, 0xc001dd3900})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/step_align.go:25 +0x178
github.com/thanos-io/thanos/pkg/queryfrontend.newQueryRangeTripperware.InstrumentMiddleware.func4.1.1({0x39d9f18?, 0xc001e7a4b0?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/instrumentation.go:31 +0x43
github.com/weaveworks/common/instrument.CollectedRequest({0x39d9f18, 0xc001e7a480}, {0x2ba5d73, 0xa}, {0x39d0a08, 0xc000966968}, 0x0?, 0xc0009ca670)
	/bitnami/blacksmith-sandox/thanos-0.37.2/pkg/mod/github.com/weaveworks/[email protected]/instrument/instrument.go:167 +0x25d
github.com/thanos-io/thanos/pkg/queryfrontend.newQueryRangeTripperware.InstrumentMiddleware.func4.1({0x39d9f18?, 0xc001e7a480?}, {0x39f7be0?, 0xc001dd3900?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/instrumentation.go:29 +0x96
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.HandlerFunc.Do(0x10?, {0x39d9f18?, 0xc001e7a480?}, {0x39f7be0?, 0xc001dd3900?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/roundtrip.go:86 +0x37
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.statsMiddleware.Do({{0x39b8700?, 0xc00096b880?}, 0x1?}, {0x39d9f18, 0xc001e7a480}, {0x39f7be0?, 0xc001dd3900?})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/stats_middleware.go:30 +0x98
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.limitsMiddleware.Do({{0x39dae78?, 0xc0001a0978?}, {0x39b85e0?, 0xc0001a0f30?}}, {0x39d9f18?, 0xc001e4d650?}, {0x39f7be0, 0xc001dd3900})
	/bitnami/blacksmith-sandox/thanos-0.37.2/src/github.com/thanos-io/thanos/internal/cortex/querier/queryrange/limits.go:99 +0x89c
github.com/thanos-io/thanos/internal/cortex/querier/queryrange.roundTripper.RoundTrip({{0x39b8560, 0xc0001a0e28}, {0x39b86e0, 0xc000b59c60}, {0x39deee0, 0xc0001a0b10}, {0xc000abe960, 0x1, 0x1}}, 0xc001e3cb40)
...

Anything else we need to know:

@Setheck Setheck changed the title Querier Panic Querier Panic - index out of range [2] with length 2 Feb 25, 2025
Copy link

dosubot bot commented Feb 25, 2025

The panic you're experiencing is likely due to an 'index out of range' error in the AnalyzesMerge function within the queryrange package. This function can cause such a panic when the length of elements is greater than the length of rootElements. The issue arises because the loop iterates over the minimum length of elements and rootElements, but the line rootElements[i].ExecutionTime += analysis[i].ExecutionTime incorrectly uses analysis[i] instead of elements[i]. If analysis has fewer elements than elements, it will result in an 'index out of range' panic [1].

To resolve this, you would need to ensure that the correct index is used in the loop to prevent accessing out-of-bounds elements. This might involve modifying the code to correctly reference elements[i] instead of analysis[i].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant