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

[2.x] 2.7.4: panic: runtime error: invalid memory address or nil pointer dereference #24536

Closed
andig opened this issue Dec 28, 2023 · 7 comments
Assignees
Labels
area/flux Issues related to the Flux query engine area/2.x OSS 2.0 related issues and PRs severity/sev-2

Comments

@andig
Copy link

andig commented Dec 28, 2023

Steps to reproduce:
Use data explorer to browser measurements and tags, finally click "Submit"

Expected behaviour:
No panic

Actual behaviour:
Panic:

ts=2023-12-28T09:45:09.933407Z lvl=info msg="Execute source panic" log_id=0mC6eiUG000 service=storage-reads error="panic: runtime error: invalid memory address or nil pointer dereference" stacktrace="goroutine 78320125 [running]:\nruntime/debug.Stack()\n\t/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/influxdata/flux/execute.(*executionState).recover(0xc0191ce1b0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/recover.go:32 +0x208\npanic({0x7f5091afe220, 0x7f50930c88a0})\n\t/go/src/runtime/panic.go:884 +0x213\ngithub.com/influxdata/influxdb/v2/tsdb/cursors.(*FloatArray).Len(0xc0191ce480?)\n\t/root/project/tsdb/cursors/arrayvalues.gen.go:30\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*floatArrayAscendingCursor).reset(0xc01926c000, 0x179bc04a57a46fb2, 0xc0191d02d0?, {0x0?, 0xc0191d1e60?, 0x1?}, 0xc0191ce480)\n\t/root/project/tsdb/engine/tsm1/array_cursor.gen.go:51 +0xef\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).buildFloatArrayCursor(_, {_, _}, {_, _, _}, {_, _, _}, {0xc019f70f20, ...}, ...)\n\t/root/project/tsdb/engine/tsm1/array_cursor_iterator.gen.go:26 +0x456\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).Next(0xc018ea0e70, {0x7f5091ec8218, 0xc0191d02d0}, 0xc01905f8d0)\n\t/root/project/tsdb/engine/tsm1/array_cursor_iterator.go:65 +0x336\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).nextArrayCursor(0xc01905f980)\n\t/root/project/storage/reads/array_cursor.gen.go:320 +0x69\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).Next(0xc01905f980)\n\t/root/project/storage/reads/array_cursor.gen.go:301 +0x46\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatWindowMeanArrayCursor).Next(0xc0192150a0)\n\t/root/project/storage/reads/array_cursor.gen.go:1049 +0x38e\ngithub.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).nextBuffer(0xc018ec3200)\n\t/root/project/storage/flux/table.gen.go:268 +0x83\ngithub.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).advance(0xc018ec3200)\n\t/root/project/storage/flux/table.gen.go:290 +0x25\ngithub.com/influxdata/influxdb/v2/storage/flux.(*table).init(...)\n\t/root/project/storage/flux/table.go:74\ngithub.com/influxdata/influxdb/v2/storage/flux.newFloatWindowTable(0xc02355f020, {0x7f4fb6bf13f8?, 0xc0192150a0}, {0x7f508f2f9d4e?, 0x7f5091ef0e40?}, {{0x0, 0x34630b8a000, 0x0}, {0x0, 0x34630b8a000, ...}, ...}, ...)\n\t/root/project/storage/flux/table.gen.go:149 +0x462\ngithub.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).handleRead(0xc0191ba200, 0x7f5091ec8218?, {0x7f5091ed51c8, 0xc0245c0d20})\n\t/root/project/storage/flux/reader.go:775 +0x108e\ngithub.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).Do(0xc0191ba200, 0x7f50910d5801?)\n\t/root/project/storage/flux/reader.go:688 +0x392\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc0191c6420, {0x7f5091ec8218?, 0xc0191d02d0}, {0x7f5091ebb6f0, 0xc0191ba200}, 0x0?)\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:69 +0xbf\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readWindowAggregateSource).run(0xc0191c6420, {0x7f5091ec8218, 0xc0191d02d0})\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:303 +0x12c\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc0191c6420, {0x7f5091ec8218, 0xc0191d02d0})\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:50 +0xa9\ngithub.com/influxdata/flux/execute.(*executionState).do.func2({0x7f5091eca278?, 0xc0191c6420})\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:535 +0x3ce\ncreated by github.com/influxdata/flux/execute.(*executionState).do\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:515 +0xf7\n"
ts=2023-12-28T09:45:21.000833Z lvl=info msg="Execute source panic" log_id=0mC6eiUG000 service=storage-reads error="panic: runtime error: invalid memory address or nil pointer dereference" stacktrace="goroutine 78321674 [running]:\nruntime/debug.Stack()\n\t/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/influxdata/flux/execute.(*executionState).recover(0xc022572cf0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/recover.go:32 +0x208\npanic({0x7f5091afe220, 0x7f50930c88a0})\n\t/go/src/runtime/panic.go:884 +0x213\ngithub.com/influxdata/influxdb/v2/tsdb/cursors.(*FloatArray).Len(0xc01a284f30?)\n\t/root/project/tsdb/cursors/arrayvalues.gen.go:30\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*floatArrayAscendingCursor).reset(0xc02119bd10, 0x179bc04cf2f20819, 0xc020ad4f90?, {0x0?, 0xc0226b6b10?, 0x1?}, 0xc01a284f30)\n\t/root/project/tsdb/engine/tsm1/array_cursor.gen.go:51 +0xef\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).buildFloatArrayCursor(_, {_, _}, {_, _, _}, {_, _, _}, {0xc019f70f20, ...}, ...)\n\t/root/project/tsdb/engine/tsm1/array_cursor_iterator.gen.go:26 +0x456\ngithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).Next(0xc021bd1c00, {0x7f5091ec8218, 0xc020ad4f90}, 0xc01a14d690)\n\t/root/project/tsdb/engine/tsm1/array_cursor_iterator.go:65 +0x336\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).nextArrayCursor(0xc01a14d740)\n\t/root/project/storage/reads/array_cursor.gen.go:320 +0x69\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).Next(0xc01a14d740)\n\t/root/project/storage/reads/array_cursor.gen.go:301 +0x46\ngithub.com/influxdata/influxdb/v2/storage/reads.(*floatWindowMeanArrayCursor).Next(0xc0226bbe30)\n\t/root/project/storage/reads/array_cursor.gen.go:1049 +0x38e\ngithub.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).nextBuffer(0xc01a23be00)\n\t/root/project/storage/flux/table.gen.go:268 +0x83\ngithub.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).advance(0xc01a23be00)\n\t/root/project/storage/flux/table.gen.go:290 +0x25\ngithub.com/influxdata/influxdb/v2/storage/flux.(*table).init(...)\n\t/root/project/storage/flux/table.go:74\ngithub.com/influxdata/influxdb/v2/storage/flux.newFloatWindowTable(0xc01370e8a0, {0x7f4fb6bf13f8?, 0xc0226bbe30}, {0x7f508f2f9d4e?, 0x7f5091ef0e40?}, {{0x0, 0x34630b8a000, 0x0}, {0x0, 0x34630b8a000, ...}, ...}, ...)\n\t/root/project/storage/flux/table.gen.go:149 +0x462\ngithub.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).handleRead(0xc01a243c00, 0x7f5091ec8218?, {0x7f5091ed51c8, 0xc028ff7590})\n\t/root/project/storage/flux/reader.go:775 +0x108e\ngithub.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).Do(0xc01a243c00, 0x1?)\n\t/root/project/storage/flux/reader.go:688 +0x392\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc01aa6d760, {0x7f5091ec8218?, 0xc020ad4f90}, {0x7f5091ebb6f0, 0xc01a243c00}, 0x0?)\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:69 +0xbf\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readWindowAggregateSource).run(0xc01aa6d760, {0x7f5091ec8218, 0xc020ad4f90})\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:303 +0x12c\ngithub.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc01aa6d760, {0x7f5091ec8218, 0xc020ad4f90})\n\t/root/project/query/stdlib/influxdata/influxdb/source.go:50 +0xa9\ngithub.com/influxdata/flux/execute.(*executionState).do.func2({0x7f5091eca278?, 0xc01aa6d760})\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:535 +0x3ce\ncreated by github.com/influxdata/flux/execute.(*executionState).do\n\t/go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:515 +0xf7\n"

Environment info:

  • Please provide the command you used to build the project, including any RUSTFLAGS.
  • System info: Run uname -srm or similar and copy the output here (we want to know your OS, architecture etc).
  • If you're running IOx in a containerised environment then details about that would be helpful.
  • Other relevant environment details: disk info, hardware setup etc.

Config:
Copy any non-default config values here or attach the full config as a gist or file.

Logs:

Readable version:

ts=2023-12-28T09:45:09.933407Z lvl=info msg="Execute source panic" log_id=0mC6eiUG000 service=storage-reads error="panic: runtime error: invalid memory address or nil pointer dereference" stacktrace="goroutine 78320125 [running]:
runtime/debug.Stack()
    /go/src/runtime/debug/stack.go:24 +0x65
github.com/influxdata/flux/execute.(*executionState).recover(0xc0191ce1b0)
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/recover.go:32 +0x208
panic({0x7f5091afe220, 0x7f50930c88a0})
    /go/src/runtime/panic.go:884 +0x213
github.com/influxdata/influxdb/v2/tsdb/cursors.(*FloatArray).Len(0xc0191ce480?)
    /root/project/tsdb/cursors/arrayvalues.gen.go:30
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*floatArrayAscendingCursor).reset(0xc01926c000, 0x179bc04a57a46fb2, 0xc0191d02d0?, {0x0?, 0xc0191d1e60?, 0x1?}, 0xc0191ce480)
    /root/project/tsdb/engine/tsm1/array_cursor.gen.go:51 +0xef
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).buildFloatArrayCursor(_, {_, _}, {_, _, _}, {_, _, _}, {0xc019f70f20, ...}, ...)
    /root/project/tsdb/engine/tsm1/array_cursor_iterator.gen.go:26 +0x456
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).Next(0xc018ea0e70, {0x7f5091ec8218, 0xc0191d02d0}, 0xc01905f8d0)
    /root/project/tsdb/engine/tsm1/array_cursor_iterator.go:65 +0x336
github.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).nextArrayCursor(0xc01905f980)
    /root/project/storage/reads/array_cursor.gen.go:320 +0x69
github.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).Next(0xc01905f980)
    /root/project/storage/reads/array_cursor.gen.go:301 +0x46
github.com/influxdata/influxdb/v2/storage/reads.(*floatWindowMeanArrayCursor).Next(0xc0192150a0)
    /root/project/storage/reads/array_cursor.gen.go:1049 +0x38e
github.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).nextBuffer(0xc018ec3200)
    /root/project/storage/flux/table.gen.go:268 +0x83
github.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).advance(0xc018ec3200)
    /root/project/storage/flux/table.gen.go:290 +0x25
github.com/influxdata/influxdb/v2/storage/flux.(*table).init(...)
    /root/project/storage/flux/table.go:74
github.com/influxdata/influxdb/v2/storage/flux.newFloatWindowTable(0xc02355f020, {0x7f4fb6bf13f8?, 0xc0192150a0}, {0x7f508f2f9d4e?, 0x7f5091ef0e40?}, {{0x0, 0x34630b8a000, 0x0}, {0x0, 0x34630b8a000, ...}, ...}, ...)
    /root/project/storage/flux/table.gen.go:149 +0x462
github.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).handleRead(0xc0191ba200, 0x7f5091ec8218?, {0x7f5091ed51c8, 0xc0245c0d20})
    /root/project/storage/flux/reader.go:775 +0x108e
github.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).Do(0xc0191ba200, 0x7f50910d5801?)
    /root/project/storage/flux/reader.go:688 +0x392
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc0191c6420, {0x7f5091ec8218?, 0xc0191d02d0}, {0x7f5091ebb6f0, 0xc0191ba200}, 0x0?)
    /root/project/query/stdlib/influxdata/influxdb/source.go:69 +0xbf
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readWindowAggregateSource).run(0xc0191c6420, {0x7f5091ec8218, 0xc0191d02d0})
    /root/project/query/stdlib/influxdata/influxdb/source.go:303 +0x12c
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc0191c6420, {0x7f5091ec8218, 0xc0191d02d0})
    /root/project/query/stdlib/influxdata/influxdb/source.go:50 +0xa9
github.com/influxdata/flux/execute.(*executionState).do.func2({0x7f5091eca278?, 0xc0191c6420})
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:535 +0x3ce
created by github.com/influxdata/flux/execute.(*executionState).do
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:515 +0xf7
"
ts=2023-12-28T09:45:21.000833Z lvl=info msg="Execute source panic" log_id=0mC6eiUG000 service=storage-reads error="panic: runtime error: invalid memory address or nil pointer dereference" stacktrace="goroutine 78321674 [running]:
runtime/debug.Stack()
    /go/src/runtime/debug/stack.go:24 +0x65
github.com/influxdata/flux/execute.(*executionState).recover(0xc022572cf0)
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/recover.go:32 +0x208
panic({0x7f5091afe220, 0x7f50930c88a0})
    /go/src/runtime/panic.go:884 +0x213
github.com/influxdata/influxdb/v2/tsdb/cursors.(*FloatArray).Len(0xc01a284f30?)
    /root/project/tsdb/cursors/arrayvalues.gen.go:30
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*floatArrayAscendingCursor).reset(0xc02119bd10, 0x179bc04cf2f20819, 0xc020ad4f90?, {0x0?, 0xc0226b6b10?, 0x1?}, 0xc01a284f30)
    /root/project/tsdb/engine/tsm1/array_cursor.gen.go:51 +0xef
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).buildFloatArrayCursor(_, {_, _}, {_, _, _}, {_, _, _}, {0xc019f70f20, ...}, ...)
    /root/project/tsdb/engine/tsm1/array_cursor_iterator.gen.go:26 +0x456
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).Next(0xc021bd1c00, {0x7f5091ec8218, 0xc020ad4f90}, 0xc01a14d690)
    /root/project/tsdb/engine/tsm1/array_cursor_iterator.go:65 +0x336
github.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).nextArrayCursor(0xc01a14d740)
    /root/project/storage/reads/array_cursor.gen.go:320 +0x69
github.com/influxdata/influxdb/v2/storage/reads.(*floatMultiShardArrayCursor).Next(0xc01a14d740)
    /root/project/storage/reads/array_cursor.gen.go:301 +0x46
github.com/influxdata/influxdb/v2/storage/reads.(*floatWindowMeanArrayCursor).Next(0xc0226bbe30)
    /root/project/storage/reads/array_cursor.gen.go:1049 +0x38e
github.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).nextBuffer(0xc01a23be00)
    /root/project/storage/flux/table.gen.go:268 +0x83
github.com/influxdata/influxdb/v2/storage/flux.(*floatWindowTable).advance(0xc01a23be00)
    /root/project/storage/flux/table.gen.go:290 +0x25
github.com/influxdata/influxdb/v2/storage/flux.(*table).init(...)
    /root/project/storage/flux/table.go:74
github.com/influxdata/influxdb/v2/storage/flux.newFloatWindowTable(0xc01370e8a0, {0x7f4fb6bf13f8?, 0xc0226bbe30}, {0x7f508f2f9d4e?, 0x7f5091ef0e40?}, {{0x0, 0x34630b8a000, 0x0}, {0x0, 0x34630b8a000, ...}, ...}, ...)
    /root/project/storage/flux/table.gen.go:149 +0x462
github.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).handleRead(0xc01a243c00, 0x7f5091ec8218?, {0x7f5091ed51c8, 0xc028ff7590})
    /root/project/storage/flux/reader.go:775 +0x108e
github.com/influxdata/influxdb/v2/storage/flux.(*windowAggregateIterator).Do(0xc01a243c00, 0x1?)
    /root/project/storage/flux/reader.go:688 +0x392
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc01aa6d760, {0x7f5091ec8218?, 0xc020ad4f90}, {0x7f5091ebb6f0, 0xc01a243c00}, 0x0?)
    /root/project/query/stdlib/influxdata/influxdb/source.go:69 +0xbf
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readWindowAggregateSource).run(0xc01aa6d760, {0x7f5091ec8218, 0xc020ad4f90})
    /root/project/query/stdlib/influxdata/influxdb/source.go:303 +0x12c
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc01aa6d760, {0x7f5091ec8218, 0xc020ad4f90})
    /root/project/query/stdlib/influxdata/influxdb/source.go:50 +0xa9
github.com/influxdata/flux/execute.(*executionState).do.func2({0x7f5091eca278?, 0xc01aa6d760})
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:535 +0x3ce
created by github.com/influxdata/flux/execute.(*executionState).do
    /go/pkg/mod/github.com/influxdata/flux@v0.194.4/execute/executor.go:515 +0xf7
@andig andig changed the title 2.7: panic: runtime error: invalid memory address or nil pointer dereference 2.7.4: panic: runtime error: invalid memory address or nil pointer dereference Dec 28, 2023
@andig
Copy link
Author

andig commented Dec 30, 2023

Note: panic seems to occur when when empty Tags are included in the query (notice right column):

Screenshot 2023-12-30 at 11 27 58

It's unclear where those tags come from.

@shengbinxu
Copy link

I encountered the same problem because there are multiple types of the same field in the measurement. After clearing the data in the measurement, it returned to normal.

Of course, I need to ensure programmatically that when writing data to Influxdb, the data type of the same field remains unchanged.

SHOW FIELD KEYS from $measurement

you can use this command to test whether or not have the same problem.

see: #8085

@philjb philjb changed the title 2.7.4: panic: runtime error: invalid memory address or nil pointer dereference [2.x] 2.7.4: panic: runtime error: invalid memory address or nil pointer dereference Feb 6, 2024
@philjb philjb added the area/2.x OSS 2.0 related issues and PRs label Feb 6, 2024
@gwossum gwossum added the area/flux Issues related to the Flux query engine label Feb 6, 2024
@pjdewitte
Copy link

@shengbinxu I might have the same problem. Can you (or someone else) elaborate on the test SHOW FIELD KEYS from $measurement?

Because my database is not configured for InfluxQL, I tried to use schema.measurementFieldKey (https://docs.influxdata.com/influxdb/cloud/query-data/flux/explore-schema/#list-fields-in-a-measurement), which returns the fields, but not their types or any problems.

@shengbinxu
Copy link

my database is not configured for InfluxQL,

You mean you can't use InfluxQL?
By default, both InfluxDB v1 and v2 can use InfluxQL (using SQL syntax to query data) without special configuration.
I am using version 2.7, and the usage is as follows:

 influx v1 shell --token $token
 show FIELD KEYS from device_metric;
image

@pjdewitte
Copy link

@shengbinxu thanks for the clarification! I indeed didn't need special configuration ("DBRP mappings", that was confusing me).

I did have to add the database name (i.e. bucket name) to the query, and I changed the query to inspect all measurements, since I don't have that many:

SHOW FIELD KEYS ON my-bucket-name;

This showed a problem in the database:

image

So it seems data was written to the database, while it should have been rejected because it had the wrong type.

I also have a stacktrace, which I hope is helpful in fixing the bug. To me it looks similar to the stacktrace of @andig, but with StringArray instead of FloatArray:

goroutine 51449 [running]:
runtime/debug.Stack()
	/go/src/runtime/debug/stack.go:24 +0x65
github.com/influxdata/flux/execute.(*executionState).recover(0xc0037b6480)
	/go/pkg/mod/github.com/influxdata/flux@v0.194.5/execute/recover.go:32 +0x208
panic({0x7f605fd969c0, 0x7f60614d3cc0})
	/go/src/runtime/panic.go:884 +0x213
github.com/influxdata/influxdb/v2/tsdb/cursors.(*StringArray).Len(0xc001818a20?)
	/root/project/tsdb/cursors/arrayvalues.gen.go:621
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*stringArrayAscendingCursor).reset(0xc004509950, 0x17b415234a9b7000, 0xc00242ab70?, {0x0?, 0x0?, 0x0?}, 0xc001818a20)
	/root/project/tsdb/engine/tsm1/array_cursor.gen.go:897 +0xef
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).buildStringArrayCursor(_, {_, _}, {_, _, _}, {_, _, _}, {0xc0013eb218, ...}, ...)
	/root/project/tsdb/engine/tsm1/array_cursor_iterator.gen.go:86 +0x456
github.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*arrayCursorIterator).Next(0xc0006872d0, {0x7f60601a2300, 0xc00242ab70}, 0xc00014afd0)
	/root/project/tsdb/engine/tsm1/array_cursor_iterator.go:71 +0x596
github.com/influxdata/influxdb/v2/storage/reads.(*multiShardArrayCursors).createCursor(0xc00014afc0, {{0x0, 0x0, 0x0}, {0x7f602e000037, 0x10, 0x3fffc9}, {0x0, 0x0, 0x0}, ...})
	/root/project/storage/reads/array_cursor.go:118 +0x182
github.com/influxdata/influxdb/v2/storage/reads.(*resultSet).Cursor(0xc003078410?)
	/root/project/storage/reads/resultset.go:61 +0x96
github.com/influxdata/influxdb/v2/storage/flux.(*filterIterator).handleRead(0xc000687180, 0xc000c39f80, {0x7f60601aff98, 0xc003078410})
	/root/project/storage/flux/reader.go:197 +0x12e
github.com/influxdata/influxdb/v2/storage/flux.(*filterIterator).Do(0xc000687180, 0x7f6060035780?)
	/root/project/storage/flux/reader.go:174 +0x130
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).processTables(0xc00399c780, {0x7f60601a2300?, 0xc00242ab70}, {0x7f60601951a0, 0xc000687180}, 0xf69606d17b890b56?)
	/root/project/query/stdlib/influxdata/influxdb/source.go:69 +0xbf
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*readFilterSource).run(0xc00399c780, {0x7f60601a2300, 0xc00242ab70})
	/root/project/query/stdlib/influxdata/influxdb/source.go:146 +0xf3
github.com/influxdata/influxdb/v2/query/stdlib/influxdata/influxdb.(*Source).Run(0xc00399c780, {0x7f60601a2300, 0xc00242ab70})
	/root/project/query/stdlib/influxdata/influxdb/source.go:50 +0xa9
github.com/influxdata/flux/execute.(*executionState).do.func2({0x7f60601a4280?, 0xc00399c780})
	/go/pkg/mod/github.com/influxdata/flux@v0.194.5/execute/executor.go:535 +0x3ce
created by github.com/influxdata/flux/execute.(*executionState).do
	/go/pkg/mod/github.com/influxdata/flux@v0.194.5/execute/executor.go:515 +0xf7

@shengbinxu
Copy link

@pjdewitte

So it seems data was written to the database, while it should have been rejected because it had the wrong type.

InfluxDB does allow writing different types of values to the same field, which can be confusing. However, it is true that I have successfully written different types of values to the same field in my business.

Can you control your business code to ensure that only the same type of value can be written to the same field?

@pjdewitte
Copy link

InfluxDB does allow writing different types of values to the same field, which can be confusing.

That's something I wasn't aware of! When I was experimenting with InfluxDB I saw error messages like field type conflict: input field “pid_count” on measurement “procstat_lookup” is type float, already exists as type integer, and assumed this meant InfluxDB enforces one type per field. Not necessarily apparently.

We will fix our business code so that the right data type is sent to InfluxDB.

Nevertheless: writing data should never make existing queries end in a panic runtime error. I hope the developers are able to resolve this issue in a future release.

davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536
davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536
davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
davidby-influx added a commit that referenced this issue Mar 18, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
davidby-influx added a commit that referenced this issue Mar 19, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
davidby-influx added a commit that referenced this issue Mar 19, 2024
Do not panic if a cursor array is nil and the number
of timestamps is retrieved.

closes #24536

(cherry picked from commit bc80e88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flux Issues related to the Flux query engine area/2.x OSS 2.0 related issues and PRs severity/sev-2
Projects
None yet
Development

No branches or pull requests

6 participants