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

query range when starttime is after endtime, prometheus panic #2140

Closed
wangweihong opened this Issue Nov 1, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@wangweihong
Copy link

wangweihong commented Nov 1, 2016

What did you do?
send http get request to url

192.168.14.100:9090/api/v1/query_range?query=up&start=1477968441.188&end=1477882041.188&step=12

  • Prometheus version:

root@ubuntu192:~/prometheus-1.2.1.linux-amd64# ./prometheus -version
prometheus, version 1.2.1 (branch: master, revision: dd66f2e)
build user: root@fd9b0daff6bd
build date: 20161010-15:58:23
go version: go1.7.1

  • Logs:
ERRO[0016] http: panic serving 192.168.4.11:38848: runtime error: index out of range
goroutine 212 [running]:
net/http.(*conn).serve.func1(0xc4228cc000)
	/usr/local/go/src/net/http/server.go:1491 +0x12a
panic(0xc4d0e0, 0xc4200140f0)
	/usr/local/go/src/runtime/panic.go:458 +0x243
github.com/prometheus/prometheus/storage/local.(*memorySeries).preloadChunks(0xc42194ed90, 0x126d520, 0x0, 0x0, 0x75083af7d7d5c73d, 0xc420226500, 0xc41fe921e8, 0x0, 0x1581dc41b84, 0xc41fe921e9)
	/go/src/github.com/prometheus/prometheus/storage/local/series.go:377 +0x84c
github.com/prometheus/prometheus/storage/local.(*memorySeries).preloadChunksForRange(0xc42194ed90, 0x75083af7d7d5c73d, 0x1581dc41b84, 0x15818a25364, 0xc420226500, 0x0, 0x8000104, 0x0, 0xffffffffffffffff)
	/go/src/github.com/prometheus/prometheus/storage/local/series.go:504 +0x2a6
github.com/prometheus/prometheus/storage/local.(*MemorySeriesStorage).preloadChunksForRange(0xc420226500, 0x75083af7d7d5c73d, 0xc42194ed90, 0x1581dc41b84, 0x15818a25364, 0x0, 0x0)
	/go/src/github.com/prometheus/prometheus/storage/local/storage.go:972 +0xd1
github.com/prometheus/prometheus/storage/local.(*MemorySeriesStorage).QueryRange(0xc420226500, 0x7f9f51bcfde0, 0xc4229145a0, 0x1581dc41b84, 0x15818a25364, 0xc422608038, 0x1, 0x1, 0x407f29, 0xc422e7c150, ...)
	/go/src/github.com/prometheus/prometheus/storage/local/storage.go:489 +0x14b
github.com/prometheus/prometheus/promql.(*Engine).populateIterators.func1(0x7f9f51c5b338, 0xc42236e0a0, 0xc41feb9de3)
	/go/src/github.com/prometheus/prometheus/promql/engine.go:484 +0x45c
github.com/prometheus/prometheus/promql.inspector.Visit(0xc4228c4360, 0x7f9f51c5b338, 0xc42236e0a0, 0x41225f, 0x1254950)
	/go/src/github.com/prometheus/prometheus/promql/ast.go:306 +0x3a
github.com/prometheus/prometheus/promql.Walk(0x11dfbe0, 0xc4228c4360, 0x7f9f51c5b338, 0xc42236e0a0)
	/go/src/github.com/prometheus/prometheus/promql/ast.go:255 +0x7b
github.com/prometheus/prometheus/promql.Inspect(0x7f9f51c5b338, 0xc42236e0a0, 0xc4228c4360)
	/go/src/github.com/prometheus/prometheus/promql/ast.go:316 +0x4b
github.com/prometheus/prometheus/promql.(*Engine).populateIterators(0xc42031cac0, 0x7f9f51bcfde0, 0xc4229145a0, 0xc4228c42d0, 0xc422e7c150, 0x2)
	/go/src/github.com/prometheus/prometheus/promql/engine.go:501 +0x11f
github.com/prometheus/prometheus/promql.(*Engine).execEvalStmt(0xc42031cac0, 0x7f9f51bcfde0, 0xc4229145a0, 0xc420fdc280, 0xc4228c42d0, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/prometheus/prometheus/promql/engine.go:355 +0x132
github.com/prometheus/prometheus/promql.(*Engine).exec(0xc42031cac0, 0x7f9f51bcfde0, 0xc4229145a0, 0xc420fdc280, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/prometheus/prometheus/promql/engine.go:344 +0x3a9
github.com/prometheus/prometheus/promql.(*query).Exec(0xc420fdc280, 0x7f9f51c51190, 0xc420fdc200, 0x1581dc8af64)
	/go/src/github.com/prometheus/prometheus/promql/engine.go:196 +0x52
github.com/prometheus/prometheus/web/api/v1.(*API).queryRange(0xc4203b80f0, 0xc4225e2000, 0x8000104, 0x0, 0xffffffffffffffff)
	/go/src/github.com/prometheus/prometheus/web/api/v1/api.go:207 +0x595
github.com/prometheus/prometheus/web/api/v1.(*API).(github.com/prometheus/prometheus/web/api/v1.queryRange)-fm(0xc4225e2000, 0xc422dbc0e0, 0x4, 0x0)
	/go/src/github.com/prometheus/prometheus/web/api/v1/api.go:126 +0x34
github.com/prometheus/prometheus/web/api/v1.(*API).Register.func1.1(0x11e4960, 0xc422dbc0e0, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/web/api/v1/api.go:110 +0x55
net/http.HandlerFunc.ServeHTTP(0xc42021f2a0, 0x11e4960, 0xc422dbc0e0, 0xc4225e2000)
	/usr/local/go/src/net/http/server.go:1726 +0x44
github.com/prometheus/prometheus/util/httputil.CompressionHandler.ServeHTTP(0x11e0620, 0xc42021f2a0, 0x11e4ae0, 0xc422608020, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/util/httputil/compression.go:90 +0x7c
github.com/prometheus/prometheus/util/httputil.(*CompressionHandler).ServeHTTP(0xc42021f2b0, 0x11e4ae0, 0xc422608020, 0xc4225e2000)
	<autogenerated>:5 +0x79
net/http.(Handler).ServeHTTP-fm(0x11e4ae0, 0xc422608020, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/web/web.go:173 +0x4d
github.com/prometheus/prometheus/vendor/github.com/prometheus/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1(0x11e51a0, 0xc420238000, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/vendor/github.com/prometheus/client_golang/prometheus/http.go:178 +0x2ab
github.com/prometheus/prometheus/vendor/github.com/prometheus/common/route.(*Router).handle.func1(0x11e51a0, 0xc420238000, 0xc4225e2000, 0x0, 0x0, 0x0)
	/go/src/github.com/prometheus/prometheus/vendor/github.com/prometheus/common/route/route.go:83 +0x2ba
github.com/prometheus/prometheus/vendor/github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc42031eb80, 0x11e51a0, 0xc420238000, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/vendor/github.com/julienschmidt/httprouter/router.go:299 +0x7ec
github.com/prometheus/prometheus/vendor/github.com/prometheus/common/route.(*Router).ServeHTTP(0xc42031cb60, 0x11e51a0, 0xc420238000, 0xc4225e2000)
	/go/src/github.com/prometheus/prometheus/vendor/github.com/prometheus/common/route/route.go:125 +0x4c
net/http.serverHandler.ServeHTTP(0xc422542080, 0x11e51a0, 0xc420238000, 0xc4225e2000)
	/usr/local/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc4228cc000, 0x11e6120, 0xc420fdc140)
	/usr/local/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2293 +0x44d
  source=<autogenerated>:38

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Nov 1, 2016

#2143 draws an additional line of defense against this.

@beorn7 beorn7 closed this Nov 1, 2016

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.