influxdata / influxdata/influxdb

panic: runtime error: invalid memory address or nil pointer dereference (InfluxDB 2.0.4)

Open
#21,199 3 comments 1 reaction 0 assignees View on GitHub
area/2.x panic
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
Unsure what causes the runtime error.

__Expected behavior:__
Not sure if related, but there's an alert I expected to be triggered but it isn't.

__Actual behavior:__

__Environment info:__

* System info: Host: `Linux 4.14.225-168.357.amzn2.x86_64 x86_64`, Docker image: `Linux 4.14.225-168.357.amzn2.x86_64 x86_64`
* InfluxDB version: `InfluxDB 2.0.4 (git: 4e7a59bb9a) build_date: 2021-02-08T17:47:02Z`
* Other relevant environment details: Docker image from `quay.io/influxdb/influxdb:v2.0.4`

__Config:__

```
docker_container:
name: influxdb
image: quay.io/influxdb/influxdb:v2.0.4
command: --reporting-disabled --http-bind-address=:9999 --engine-path=/data/engine --bolt-path=/data/influxd.bolt
```

__Logs:__

Following text is seen repeating thrice in the logs.

```
ts=2021-04-12T13:51:55.306493Z lvl=info msg="Retention policy deletion check (start)" log_id=0TBMC3CG000 service=retention op_name=retention_delete_check op_event=start
ts=2021-04-12T13:51:55.306670Z lvl=info msg="Retention policy deletion check (end)" log_id=0TBMC3CG000 service=retention op_name=retention_delete_check op_event=end op_elapsed=0.185ms
ts=2021-04-12T13:57:53.563922Z lvl=info msg="Execute source panic" log_id=0TBMC3CG000 service=storage-reads error="panic: runtime error: invalid memory address or nil pointer dereference" stacktrace=

goroutine 156462181 [running]:

runtime/debug.Stack(0xc0011a0240, 0x39feb00, 0x2757856)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9f
github.com/influxdata/flux/execute.(*executionState).do.func1.1(0xc00e4a9a80)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.104.0/execute/executor.go:279 +0x1e5
panic(0x2395400, 0x4bbf8e0)
/usr/local/go/src/runtime/panic.go:969 +0x175
github.com/influxdata/influxdb/v2/v1/services/storage.(*Store).measurementFields.func1(0x0, 0x0)
/home/circleci/go/src/github.com/influxdata/influxdb/v1/services/storage/store.go:546 +0x22
panic(0x23b14a0, 0xc016a5ab40)
/usr/local/go/src/runtime/panic.go:969 +0x175
github.com/influxdata/influxdb/v2/v1/services/storage.(*Store).measurementFields(0xc000a21950, 0x3a4f080, 0xc016a5a810, 0xc010853bb8, 0x0, 0x0, 0x0, 0x0)
/home/circleci/go/src/github.com/influxdata/influxdb/v1/services/storage/store.go:549 +0x2ea
github.com/influxdata/influxdb/v2/v1/services/storage.(*Store).TagValues(0xc000a21950, 0x3a4f080, 0xc016a5a810, 0xc016a5ab10, 0x0, 0xc008ae0cb0, 0x40f6d8, 0x20)
/home/circleci/go/src/github.com/influxdata/influxdb/v1/services/storage/store.go:406 +0x3c5
github.com/influxdata/influxdb/v2/storage/flux.(*tagValuesIterator).Do(0xc00e4a9d00, 0xc008a39bc0, 0x498546, 0x607451e5)
/home/circleci/go/src/github.com/influxdata/influxdb/storage/flux/reader.go:949 +0x162
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc00fb90b60, 0x3a4f080, 0xc016a5a810, 0x3a29e00, 0xc00e4a9d00, 0x167520f4f47e8413, 0x167520f4f4129b08, 0x0)
/home/circleci/go/src/github.com/influxdata/influxdb/query/stdlib/influxdata/influxdb/source.go:76 +0x94
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readTagValuesSource).run(0xc00fb90b60, 0x3a4f080, 0xc016a5a810, 0x4426b9d2a158e946, 0x2741fa4)
/home/circleci/go/src/github.com/influxdata/influxdb/query/stdlib/influxdata/influxdb/source.go:491 +0x178
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc00fb90b60, 0x3a4f080, 0xc016a5a810)
/home/circleci/go/src/github.com/influxdata/influxdb/query/stdlib/influxdata/influxdb/source.go:56 +0x33c
github.com/influxdata/flux/execute.(*executionState).do.func1(0x3a4f080, 0xc016a5a810, 0xc00f4d8360, 0xc00e4a9a80, 0x3a50c00, 0xc00fb90b60)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.104.0/execute/executor.go:284 +0x1da
created by github.com/influxdata/flux/execute.(*executionState).do
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.104.0/execute/executor.go:254 +0xf8

ts=2021-04-12T14:06:02.146690Z lvl=info msg="index opened with 8 partitions" log_id=0TBMC3CG000 service=storage-engine index=tsi
ts=2021-04-12T14:06:02.147532Z lvl=info msg="Reindexing TSM data" log_id=0TBMC3CG000 service=storage-engine engine=tsm1 db_shard_id=200
ts=2021-04-12T14:06:02.147562Z lvl=info msg="Reindexing WAL data" log_id=0TBMC3CG000 service=storage-engine engine=tsm1 db_shard_id=200
ts=2021-04-12T14:21:55.306502Z lvl=info msg="Retention policy deletion check (start)" log_id=0TBMC3CG000 service=retention op_name=retention_delete_check op_event=start
ts=2021-04-12T14:21:55.306677Z lvl=info msg="Retention policy deletion check (end)" log_id=0TBMC3CG000 service=retention op_name=retention_delete_check op_event=end op_elapsed=0.186ms
```

__Performance:__

[iostat.txt](https://github.com/influxdata/influxdb/files/6305296/iostat.txt)

Contributor guide

Open the contributing guide

Research direction

Start with v1/services/storage/store.go, especially measurementFields and TagValues, then trace the call through storage/flux/reader.go and query/stdlib/influxdata/influxdb/source.go. Reproduce the alert-related query from the InfluxDB 2.0.4 environment if possible and determine the conditions behind the nil-pointer panic. The issue does not define clear expected behavior beyond avoiding the panic and investigating the missing alert.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.