influxdata / influxdata/influxdb

flux query panic: key not defined in object

Open
#23,718 0 comments 0 reactions 0 assignees View on GitHub
area/flux kind/bug
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

A、B has same group keys, but some table of B miss a column, below is my example data, then running join function leads a panic:
```
import "join"

A = ...
B = ...
join.time(left: A, right: B, as: (l, r) => ({l with _value: float(v: l._value / r._value)}))
```

Expected behavior:
The query runs successfully

Actual behavior:
Query error with a runtime panic

panic error:
```
ts=2022-09-09T07:23:42.950571Z lvl=info msg="Dispatcher panic" log_id=0cnwWYkW000 service=storage-reads component=dispatcher error="panic: key "sdkid" not defined in object" stacktrace="goroutine 5116343875 [running]:
runtime/debug.Stack()
/go/src/runtime/debug/stack.go:24 +0x65
github.com/influxdata/flux/execute.(*poolDispatcher).recover(0xccd1fe9a40)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/recover.go:53 +0x205
panic({0x7fbd58778b00, 0xc9e586a780})
/go/src/runtime/panic.go:838 +0x207
github.com/influxdata/flux/values.(*object).Set(0xcce0c17f40?, {0xc461599820?, 0x5?}, {0x7fbd58ae6938?, 0xc6a7a36ff0?})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/values/object.go:178 +0x1aa
github.com/influxdata/flux/stdlib/join.rowFromChunk({{{0x7fbd58ae5278, 0xccde27a2d0}, {0xccde42f4a0, 0x13, 0x13}, {0xccde899040, 0x13, 0x13}}}, 0xc002700400?, {0x4, ...})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:635 +0x1d6
github.com/influxdata/flux/stdlib/join.joinRows.getRow({0xc8c7a479c0?, 0x1, 0x8?}, 0xc01bea2ad0?, {0x27?, {0x7fbd58abeba8?, 0xce315ff6c0?}, 0xc01bea2af0?})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:587 +0x2bf
github.com/influxdata/flux/stdlib/join.(*JoinFn).crossProduct(0xc01bea2ee8, {0x7fbd58acde28, 0xd176ef6c40}, 0xc01bea2f30, {0x7fbd58aced78, 0xccd1fbf270})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/join_fn.go:126 +0xd7
github.com/influxdata/flux/stdlib/join.(*JoinFn).Eval(0xc01bea2ee8, {0x7fbd58acde28, 0xd176ef6c40}, 0xc01bea2f30, {0xc5bea499a7, 0x5}, {0x7fbd58aced78, 0xccd1fbf270})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/join_fn.go:114 +0x6f0
github.com/influxdata/flux/stdlib/join.(*joinProduct).evaluate(...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:626
github.com/influxdata/flux/stdlib/join.(*joinState).join(0xccde45f900, {0x7fbd58acde28, 0xd176ef6c40}, {0xc5bea499a7, 0x5}, 0xccdde45680, 0x5, {0x7fbd58aced78, 0xccd1fbf270}, {0xccde422600, ...}, ...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:427 +0x2f7
github.com/influxdata/flux/stdlib/join.(*MergeJoinTransformation).mergeJoin(0xccde088e40, {{{0x7fbd58ae5278, 0xccde27a2d0}, {0xccde42f4a0, 0x13, 0x13}, {0xccdf4823c0, 0x13, 0x13}}}, 0xccde45f900, ...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:219 +0x1c5
github.com/influxdata/flux/stdlib/join.(*MergeJoinTransformation).processChunk(0xccde088e40, {{{0x7fbd58ae5278, 0xccde27a2d0}, {0xccde42f4a0, 0x13, 0x13}, {0xccdf4823c0, 0x13, 0x13}}}, {0x7fbd587d7e00, ...}, ...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:177 +0x590
github.com/influxdata/flux/stdlib/join.(*MergeJoinTransformation).ProcessMessage(0xccde088e40, {0x7fbd58acebb8?, 0xcce0c27200})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/stdlib/join/merge_join.go:86 +0x2d6
github.com/influxdata/flux/execute.(*transportTransformationAdapter).processChunk(...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:762
github.com/influxdata/flux/execute.(*transportTransformationAdapter).Process.func1({0x7fbd58ae3370?, 0xc72e4b1ec0?})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:749 +0x275
github.com/influxdata/flux/execute.(*consecutiveTransportTable).Do.func1({0x7fbd58ae3370, 0xc72e4b1ec0})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:572 +0x489
github.com/influxdata/flux/execute/table.(*BufferedTable).Do(0x10?, 0xcd62c4aed0)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/table/buffered.go:69 +0x19b
github.com/influxdata/flux/execute.(*consecutiveTransportTable).Do(0xd34f1cb4e8, 0xcd4530fb00)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:554 +0x87
github.com/influxdata/flux/execute.(*transportTransformationAdapter).Process(0xccc30610e0, {0x5a, 0xfa, 0xa2, 0xb5, 0x78, 0x4b, 0x54, 0xe6, 0x9c, ...}, ...)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:746 +0x390
github.com/influxdata/flux/execute.(*transportTransformationAdapter).ProcessMessage(0xccc30610e0, {0x7fbd58acebf0?, 0xce315fef00})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:727 +0x13e
github.com/influxdata/flux/execute.(*consecutiveTransport).processMessage(0xccdd974a50, {0x7fbd58acebf0, 0xce315fef00})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:297 +0xca
github.com/influxdata/flux/execute.(*consecutiveTransport).processMessages(0xccdd974a50, {0x7fbd58acde28?, 0xd176ef6c40?}, 0xa)
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/transport.go:251 +0xe5
github.com/influxdata/flux/execute.(*poolDispatcher).doWork(0xccd1fe9a40, {0x7fbd58acde28, 0xd176ef6c40})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/dispatcher.go:157 +0x19f
github.com/influxdata/flux/execute.(*poolDispatcher).run(0xccd1fe9a40, {0x7fbd58acde28, 0xd176ef6c40})
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/dispatcher.go:135 +0x4f
github.com/influxdata/flux/execute.(*poolDispatcher).Start.func1()
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/dispatcher.go:75 +0x86
created by github.com/influxdata/flux/execute.(*poolDispatcher).Start
/go/pkg/mod/github.com/influxdata/flux@v0.179.0/execute/dispatcher.go:71 +0x48
"
```

Environment info:
InfluxDB version: 2.4, flux version: 0.179.0

Contributor guide

Open the contributing guide

Research direction

Start in stdlib/join/merge_join.go at rowFromChunk, where the stack trace shows the panic, and inspect values/object.go at Set. Reproduce the join case with matching group keys and a missing column, then verify the query completes without a runtime panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.