prometheus: SIGSEGV after writing block
What did you do?
After upgrading prometheus crashes after writing a block to disk:
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7becc27ed8b3 pc=0x284122c]
goroutine 21496756 gp=0xc08c4bc380 m=39 mp=0xc093f06008 [running]:
runtime.throw({0x3942abb?, 0xc001eb3300?})
/usr/local/go/src/runtime/panic.go:1023 +0x5c fp=0xc085183a58 sp=0xc085183a28 pc=0x43e95c
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:895 +0x285 fp=0xc085183ab8 sp=0xc085183a58 pc=0x457405
encoding/binary.Uvarint(...)
/usr/local/go/src/encoding/binary/varint.go:72
github.com/prometheus/prometheus/tsdb/chunks.(*Reader).ChunkOrIterable(0xc00395bc70, {0x148f68b3, {0x0, 0x0}, 0x19076d5c700, 0x1907701b900, 0x0, 0x0, 0x0})
/app/tsdb/chunks/chunks.go:681 +0x22c fp=0xc085183bb0 sp=0xc085183ab8 pc=0x284122c
github.com/prometheus/prometheus/tsdb.(*blockChunkReader).ChunkOrIterable(0x1?, {0x148f68b3, {0x0, 0x0}, 0x19076d5c700, 0x1907701b900, 0x0, 0x0, 0x0})
<autogenerated>:1 +0x70 fp=0xc085183c08 sp=0xc085183bb0 pc=0x2b447f0
This always happens right after it wrote a new block to disk:
log search for this crash it shows it always happens on the hour, i.e. when it writes the block
- Prometheus crashes after writing a block
- The block is valid when it starts up, and seems to contain the right amount of data
promtool tsdb validateandtsdb dumpseem to handle the block just fine- only happens on a subset of our instances, only on the biggest (>1 million series)
"headStats": {
"numSeries": 1540181,
"numLabelPairs": 58459,
"chunkCount": 2742545,
"minTime": 1720173600000,
"maxTime": 1720177450840
},
- crashes are not constant, some nodes crash more than others. Crash count in the last 48h, each cluster has 2 instances in ha pair:
33 cluster-2
10 cluster-4
8 cluster-1
6 cluster-3
What did you expect to see?
Prometheus not to crash
What did you see instead? Under which circumstances?
System information
Linux 5.15.146+ x86_64
Prometheus version
prometheus, version 2.53.0 (branch: HEAD, revision: 4c35b9250afefede41c5f5acd76191f90f625898)
build user: root@7f8d89cbbd64
build date: 20240619-07:39:12
go version: go1.22.4
platform: linux/amd64
tags: netgo,builtinassets,stringlabels
Prometheus configuration file
No response
Prometheus setup
This prometheus is managed by the prometheus operator in a (google) GKE k8s cluster. Disks are pd-ssd, standard persistent ssd storage offered by google.
The setup includes a thanos side car for shipping to a bucket and querying
Alertmanager version
No response
Alertmanager configuration file
No response
Logs
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7becc27ed8b3 pc=0x284122c]
goroutine 21496756 gp=0xc08c4bc380 m=39 mp=0xc093f06008 [running]:
runtime.throw({0x3942abb?, 0xc001eb3300?})
/usr/local/go/src/runtime/panic.go:1023 +0x5c fp=0xc085183a58 sp=0xc085183a28 pc=0x43e95c
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:895 +0x285 fp=0xc085183ab8 sp=0xc085183a58 pc=0x457405
encoding/binary.Uvarint(...)
/usr/local/go/src/encoding/binary/varint.go:72
github.com/prometheus/prometheus/tsdb/chunks.(*Reader).ChunkOrIterable(0xc00395bc70, {0x148f68b3, {0x0, 0x0}, 0x19076d5c700, 0x1907701b900, 0x0, 0x0, 0x0})
/app/tsdb/chunks/chunks.go:681 +0x22c fp=0xc085183bb0 sp=0xc085183ab8 pc=0x284122c
github.com/prometheus/prometheus/tsdb.(*blockChunkReader).ChunkOrIterable(0x1?, {0x148f68b3, {0x0, 0x0}, 0x19076d5c700, 0x1907701b900, 0x0, 0x0, 0x0})
<autogenerated>:1 +0x70 fp=0xc085183c08 sp=0xc085183bb0 pc=0x2b447f0
github.com/prometheus/prometheus/tsdb.(*populateWithDelGenericSeriesIterator).next(0xc047264640, 0x1)
/app/tsdb/querier.go:654 +0x36b fp=0xc085183d78 sp=0xc085183c08 pc=0x2b287eb
github.com/prometheus/prometheus/tsdb.(*populateWithDelChunkSeriesIterator).Next(0xc047264640)
/app/tsdb/querier.go:825 +0x113 fp=0xc085183db8 sp=0xc085183d78 pc=0x2b293b3
github.com/prometheus/prometheus/storage.(*compactChunkIterator).Next(0xc0be977c20)
/app/storage/merge.go:724 +0x82 fp=0xc085184070 sp=0xc085183db8 pc=0x2854782
github.com/prometheus/prometheus/storage/remote.StreamChunkedReadResponses({0x44251c0, 0xc13f854750}, 0x0, {0x445f720, 0xc0c36722f0}, {0xc14bd88000, 0x4, 0x4}, 0x100000, 0xc002078e70)
/app/storage/remote/codec.go:246 +0x1bd fp=0xc085184338 sp=0xc085184070 pc=0x2a6211d
github.com/prometheus/prometheus/storage/remote.(*readHandler).remoteReadStreamedXORChunks.func1(0xc0851844e8, 0xc11db18d80, 0xc0025f0060, {0x445f058, 0xc11db18c60}, {0x7bed301a5278, 0xc09708de50}, {0x7bed301a52c8, 0xc09708de50}, 0xc0851844c8, ...)
/app/storage/remote/read_handler.go:210 +0x211 fp=0xc085184460 sp=0xc085184338 pc=0x2a798b1
github.com/prometheus/prometheus/storage/remote.(*readHandler).remoteReadStreamedXORChunks(0xc0025f0060, {0x445f058, 0xc11db18c60}, {0x7bed301a5278, 0xc09708de50}, 0xc09708dea0, 0xc11db18d80, {0xc14bd88000, 0x4, 0x4})
/app/storage/remote/read_handler.go:227 +0x245 fp=0xc085184530 sp=0xc085184460 pc=0x2a79525
github.com/prometheus/prometheus/storage/remote.(*readHandler).ServeHTTP(0xc0025f0060, {0x7bed301a5278, 0xc09708de50}, 0xc0cb24c6c0)
/app/storage/remote/read_handler.go:110 +0x51a fp=0xc085184b10 sp=0xc085184530 pc=0x2a7845a
github.com/prometheus/prometheus/web/api/v1.(*API).remoteRead(0xc11db18d20?, {0x7bed301a5278?, 0xc09708de50?}, 0x4427a00?)
/app/web/api/v1/api.go:1645 +0x32 fp=0xc085184b48 sp=0xc085184b10 pc=0x2b6eff2
github.com/prometheus/prometheus/web/api/v1.(*API).remoteRead-fm({0x7bed301a5278?, 0xc09708de50?}, 0xc11db18d20?)
<autogenerated>:1 +0x36 fp=0xc085184b78 sp=0xc085184b48 pc=0x2b77eb6
github.com/prometheus/prometheus/web.(*Handler).testReady-fm.(*Handler).testReady.func1({0x7bed301a5278, 0xc09708de50}, 0xc0cb24c6c0)
/app/web/web.go:548 +0x86 fp=0xc085184bc8 sp=0xc085184b78 pc=0x2b84166
net/http.HandlerFunc.ServeHTTP(0x7bed301a5278?, {0x7bed301a5278?, 0xc09708de50?}, 0x0?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc085184bf0 sp=0xc085184bc8 pc=0x715d89
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerResponseSize.func1({0x7bed301a5278?, 0xc09708de00?}, 0xc0cb24c6c0)
/go/pkg/mod/github.com/prometheus/client_golang@v1.19.1/prometheus/promhttp/instrument_server.go:296 +0xcf fp=0xc085184d10 sp=0xc085184bf0 pc=0x18d07ef
net/http.HandlerFunc.ServeHTTP(0xc11db18cc0?, {0x7bed301a5278?, 0xc09708de00?}, 0x50?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc085184d38 sp=0xc085184d10 pc=0x715d89
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x7bed301a5278, 0xc09708de00}, 0xc0cb24c6c0)
/go/pkg/mod/github.com/prometheus/client_golang@v1.19.1/prometheus/promhttp/instrument_server.go:109 +0xc2 fp=0xc085184e60 sp=0xc085184d38 pc=0x18cf422
net/http.HandlerFunc.ServeHTTP(0x4455800?, {0x7bed301a5278?, 0xc09708de00?}, 0xc0931c0f28?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc085184e88 sp=0xc085184e60 pc=0x715d89
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x4455800?, 0xc14493fc20?}, 0xc0cb24c6c0)
/go/pkg/mod/github.com/prometheus/client_golang@v1.19.1/prometheus/promhttp/instrument_server.go:147 +0xc3 fp=0xc085184fa0 sp=0xc085184e88 pc=0x18d01a3
github.com/prometheus/prometheus/web.(*Handler).Run.setPathWithPrefix.func5.1({0x4455800, 0xc14493fc20}, 0xc0cb24c5a0)
/app/web/web.go:808 +0xb3 fp=0xc085185000 sp=0xc085184fa0 pc=0x2b81b53
github.com/prometheus/common/route.(*Router).handle.func1({0x4455800, 0xc14493fc20}, 0xc0cb24c480, {0x0, 0x0, 0x41acf8?})
/go/pkg/mod/github.com/prometheus/common@v0.54.0/route/route.go:83 +0x1e9 fp=0xc085185098 sp=0xc085185000 pc=0x2b58dc9
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc0029b22a0, {0x4455800, 0xc14493fc20}, 0xc0cb24c480)
/go/pkg/mod/github.com/julienschmidt/httprouter@v1.3.0/router.go:387 +0x7eb fp=0xc0851851a0 sp=0xc085185098 pc=0x2b55c4b
github.com/prometheus/common/route.(*Router).ServeHTTP(0x0?, {0x4455800?, 0xc14493fc20?}, 0x7?)
/go/pkg/mod/github.com/prometheus/common@v0.54.0/route/route.go:126 +0x25 fp=0xc0851851d0 sp=0xc0851851a0 pc=0x2b593c5
github.com/prometheus/prometheus/web.(*Handler).Run.StripPrefix.func7({0x4455800, 0xc14493fc20}, 0xc0cb24c360)
/usr/local/go/src/net/http/server.go:2209 +0x262 fp=0xc085185258 sp=0xc0851851d0 pc=0x2b81902
net/http.HandlerFunc.ServeHTTP(0xc0029b6090?, {0x4455800?, 0xc14493fc20?}, 0xc0931c12c0?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc085185280 sp=0xc085185258 pc=0x715d89
net/http.(*ServeMux).ServeHTTP(0x445f058?, {0x4455800, 0xc14493fc20}, 0xc0cb24c360)
/usr/local/go/src/net/http/server.go:2683 +0x1ad fp=0xc0851852d0 sp=0xc085185280 pc=0x717c6d
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.(*middleware).serveHTTP(0xc002d58000, {0x4449aa0, 0xc1449242a0}, 0xc0c310dd40, {0x4424340, 0xc0029b6000})
/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.52.0/handler.go:212 +0x1003 fp=0xc085185888 sp=0xc0851852d0 pc=0x15bb4a3
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp.NewMiddleware.func1.1({0x4449aa0?, 0xc1449242a0?}, 0x7fff96775563?)
/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp@v0.52.0/handler.go:73 +0x35 fp=0xc0851858c8 sp=0xc085185888 pc=0x15b9cf5
net/http.HandlerFunc.ServeHTTP(0x0?, {0x4449aa0?, 0xc1449242a0?}, 0xc144924380?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc0851858f0 sp=0xc0851858c8 pc=0x715d89
github.com/prometheus/prometheus/web.(*Handler).Run.withStackTracer.func9({0x4449aa0?, 0xc1449242a0?}, 0xc144924380?)
/app/web/web.go:104 +0x82 fp=0xc085185950 sp=0xc0851858f0 pc=0x2b81362
net/http.HandlerFunc.ServeHTTP(0x7fff96775563?, {0x4449aa0?, 0xc1449242a0?}, 0x6279c20?)
/usr/local/go/src/net/http/server.go:2166 +0x29 fp=0xc085185978 sp=0xc085185950 pc=0x715d89
github.com/prometheus/exporter-toolkit/web.(*webHandler).ServeHTTP(0xc002d3aa00, {0x4449aa0, 0xc1449242a0}, 0xc0c310dd40)
/go/pkg/mod/github.com/prometheus/exporter-toolkit@v0.11.0/web/handler.go:102 +0x41d fp=0xc085185b60 sp=0xc085185978 pc=0xa3e0dd
net/http.serverHandler.ServeHTTP({0x4435438?}, {0x4449aa0?, 0xc1449242a0?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e fp=0xc085185b90 sp=0xc085185b60 pc=0x71948e
net/http.(*conn).serve(0xc0a7e28ea0, {0x445f058, 0xc002e90660})
/usr/local/go/src/net/http/server.go:2039 +0x5e8 fp=0xc085185fb8 sp=0xc085185b90 pc=0x714768
net/http.(*Server).Serve.gowrap3()
/usr/local/go/src/net/http/server.go:3285 +0x28 fp=0xc085185fe0 sp=0xc085185fb8 pc=0x719ca8
runtime.goexit({})
/usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc085185fe8 sp=0xc085185fe0 pc=0x479701
created by net/http.(*Server).Serve in goroutine 426
/usr/local/go/src/net/http/server.go:3285 +0x4b4
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 — committed to machine424/prometheus by machine424 2 years ago
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 Signed-off-by: machine424 <ayoubmrini424@gmail.com> — committed to machine424/prometheus by machine424 2 years ago
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 Signed-off-by: machine424 <ayoubmrini424@gmail.com> — committed to machine424/prometheus by machine424 2 years ago
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 Signed-off-by: machine424 <ayoubmrini424@gmail.com> — committed to machine424/prometheus by machine424 2 years ago
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 Signed-off-by: machine424 <ayoubmrini424@gmail.com> — committed to machine424/prometheus by machine424 2 years ago
- test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 Signed-off-by: machine424 <ayoubmrini424@gmail.com> — committed to machine424/prometheus by machine424 2 years ago
- Merge pull request #14599 from machine424/sigsegv test(tsdb): add a reproducer for https://github.com/prometheus/prometheus/issues/14422 — committed to prometheus/prometheus by bboreham 2 years ago
2.53.2 now released.
If this is accepted as a fix, then yes, since 2.53 is an LTS release.