influxdata / influxdata/influxdb
Panic on Values.Deduplicate and cacheKeyIterator.encode
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Bug report:__
__Logs:__
```
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: panic: runtime error: invalid memory address or nil pointer dereference
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xbef9a3]
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: goroutine 35090295734 [running]:
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: github.com/influxdata/influxdb/tsdb/engine/tsm1.(*cacheKeyIterator).encode.func1(0xc471d4b3c8, 0x1, 0x17970c, 0xc1634f7100)
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/compact.go:1953 +0x363
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: created by github.com/influxdata/influxdb/tsdb/engine/tsm1.(*cacheKeyIterator).encode
Jul 20 21:58:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/compact.go:1921 +0xa3
Jul 20 21:58:39 hb06-umon-147-233 systemd: influx_storage.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 20 21:58:39 hb06-umon-147-233 systemd: Unit influx_storage.service entered failed state.
Jul 20 21:58:39 hb06-umon-147-233 systemd: influx_storage.service failed.
Jul 20 21:58:39 hb06-umon-147-233 systemd: influx_storage.service holdoff time over, scheduling restart.
Jul 20 21:58:39 hb06-umon-147-233 systemd: Started influx_storage, a storage service for influx-galaxy.
Jul 20 21:58:39 hb06-umon-147-233 systemd: Starting influx_storage, a storage service for influx-galaxy...
Jul 20 21:58:39 hb06-umon-147-233 influx_storage: ts=2020-07-20T13:58:39.437414Z lvl=info msg="Influx Storage starting" log_id=0O789OGl000 version=galaxy-storage-v1.0.5 branch=develop commit=a52903c
Jul 20 21:58:39 hb06-umon-147-233 influx_storage: ts=2020-07-20T13:58:39.437489Z lvl=info msg="Go runtime" log_id=0O789OGl000 version=go1.14 maxprocs=32
Jul 20 22:08:27 hb06-umon-147-233 influx_storage: ts=2020-07-20T14:08:27.241945Z lvl=info msg="Listening for signals" log_id=0O789OGl000
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: panic: runtime error: invalid memory address or nil pointer dereference
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xb8a0d9]
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: goroutine 6745 [running]:
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: github.com/influxdata/influxdb/tsdb/engine/tsm1.Values.Deduplicate(0xc18004ee40, 0x2, 0x2, 0xc01418b6e0, 0x451cfb, 0xc120a1f3c0)
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/encoding.gen.go:69 +0x69
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: github.com/influxdata/influxdb/tsdb/engine/tsm1.(*entry).deduplicate(0xc14a2ea180)
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/cache.go:110 +0x7e
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: github.com/influxdata/influxdb/tsdb/engine/tsm1.(*Cache).Deduplicate.func1(0xc120a1f3c0, 0x37, 0x40, 0xc14a2ea180, 0x37, 0x40)
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/cache.go:435 +0x2b
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: github.com/influxdata/influxdb/tsdb/engine/tsm1.(*ring).apply.func1(0xc461fe40d0, 0xe18b40, 0xc49b84d3e0, 0xc23febfae0)
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/ring.go:160 +0x13e
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: created by github.com/influxdata/influxdb/tsdb/engine/tsm1.(*ring).apply
Jul 20 22:08:28 hb06-umon-147-233 influx_storage: /data/golang/own/pkg/mod/github.com/influxdata/influxdb@v1.7.8/tsdb/engine/tsm1/ring.go:155 +0xef
Jul 20 22:08:39 hb06-umon-147-233 systemd: influx_storage.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 20 22:08:39 hb06-umon-147-233 systemd: Unit influx_storage.service entered failed state.
Jul 20 22:08:39 hb06-umon-147-233 systemd: influx_storage.service failed.
Jul 20 22:08:39 hb06-umon-147-233 systemd: influx_storage.service holdoff time over, scheduling restart.
Jul 20 22:08:39 hb06-umon-147-233 systemd: Started influx_storage, a storage service for influx-galaxy.
Jul 20 22:08:39 hb06-umon-147-233 systemd: Starting influx_storage, a storage service for influx-galaxy...
Jul 20 22:08:39 hb06-umon-147-233 influx_storage: ts=2020-07-20T14:08:39.686639Z lvl=info msg="Influx Storage starting" log_id=0O78j0zl000 version=galaxy-storage-v1.0.5 branch=develop commit=a52903c
Jul 20 22:08:39 hb06-umon-147-233 influx_storage: ts=2020-07-20T14:08:39.686679Z lvl=info msg="Go runtime" log_id=0O78j0zl000 version=go1.14 maxprocs=32
Jul 20 22:17:55 hb06-umon-147-233 influx_storage: ts=2020-07-20T14:17:55.201120Z lvl=info msg="Listening for signals" log_id=0O78j0zl000
```
__Environment info:__
```
influxdb 1.7.8 / Linux version 4.1.0-31.el7/ Centos7
```
__Actual behavior:__
It happends twice:
1. cacheKeyIterato.encode, tsm1/compact.go, line 1953, : ` minTime, maxTime := values[0].UnixNano(), values[end-1].UnixNano()` 。
2. Values.Deduplicate, endoding.gen.go, line 69 : `if a[i-1].UnixNano() >= a[i].UnixNano() {` 。
Panic wolud happend when values[i]/a[i] is nil in Values, I had checked all codes about writing Values, but i can't find a nil pointer Value which was not init by the NewXXXValue function.
I don't know why this happened......
Could anyone help me ?
Contributor guide
Assessment
This issue has not been assessed yet.