influxdata / influxdata/influxdb
panic: Inconsistent plan graph: successor does not have edge back to predecessor
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Hi,
I got a panic message while executing the request below.
The raw journalctl message:
```
Jun 25 09:39:45 stat01 influxd[926]: ts=2021-06-25T07:39:45.634697Z lvl=info msg="panic during program start" log_id=0UmhPUa0000 service=storage-reads error="panic: Inconsistent plan graph: successor does not have edge back to predecessor" stacktrace="goroutine 693 [running]:\nruntime/debug.Stack(0xc001820f00, 0x0, 0x220f45f)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery.func1(0xc008e85800, 0xc001908000)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:457 +0x153\npanic(0x38ac5e0, 0x3d32260)\n\t/usr/local/go/src/runtime/panic.go:969 +0x175\ngithub.com/influxdata/flux/plan.updateSuccessors(0xc008719100, 0x3deaba0, 0xc004f30930, 0x3deac40, 0xc00398b0e0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/heuristic_planner.go:170 +0x36c\ngithub.com/influxdata/flux/plan.(*heuristicPlanner).Plan(0xc005755d70, 0x3dc22c0, 0xc0009bc300, 0xc008719100, 0xc008719100, 0x0, 0x0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/heuristic_planner.go:118 +0x4a5\ngithub.com/influxdata/flux/plan.(*physicalPlanner).Plan(0xc009756180, 0x3dc22c0, 0xc0009bc300, 0xc008719100, 0xc008719100, 0x0, 0x0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/physical.go:46 +0x52\ngithub.com/influxdata/flux/plan.(*planner).Plan(0xc009756360, 0x3dc22c0, 0xc0009bc300, 0xc008860630, 0x0, 0x0, 0x3d71f40)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/builder.go:49 +0xce\ngithub.com/influxdata/flux/lang.buildPlan(0x3dc22c0, 0xc0009bc300, 0xc008860630, 0xc00513b220, 0x0, 0x0, 0x0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/lang/compiler.go:157 +0x325\ngithub.com/influxdata/flux/lang.(*AstProgram).Start(0xc00513b270, 0x3dc22c0, 0xc0030c6240, 0xc00513b360, 0x0, 0x0, 0x0, 0x0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/lang/compiler.go:500 +0x5c7\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery(0xc001908000, 0xc008e85800)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:480 +0x12f\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).processQueryQueue(0xc001908000)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:438 +0x4e\ngithub.com/influxdata/influxdb/v2/query/control.New.func1(0xc001908000)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:220 +0x59\ncreated by github.com/influxdata/influxdb/v2/query/control.New\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:218 +0x7e5\n"
```
formatted backtrace:
```
Jun 25 09:39:45 stat01 influxd[926]:
ts=2021-06-25T07:39:45.634697Z
lvl=info
msg="panic during program start"
log_id=0UmhPUa0000
service=storage-reads
error="panic: Inconsistent plan graph: successor does not have edge back to predecessor"
stacktrace="
goroutine 693 [running]:
runtime/debug.Stack(0xc001820f00, 0x0, 0x220f45f)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9f
github.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery.func1(0xc008e85800, 0xc001908000)
/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:457 +0x153
panic(0x38ac5e0, 0x3d32260)
/usr/local/go/src/runtime/panic.go:969 +0x175
github.com/influxdata/flux/plan.updateSuccessors(0xc008719100, 0x3deaba0, 0xc004f30930, 0x3deac40, 0xc00398b0e0)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/heuristic_planner.go:170 +0x36c
github.com/influxdata/flux/plan.(*heuristicPlanner).Plan(0xc005755d70, 0x3dc22c0, 0xc0009bc300, 0xc008719100, 0xc008719100, 0x0, 0x0)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/heuristic_planner.go:118 +0x4a5
github.com/influxdata/flux/plan.(*physicalPlanner).Plan(0xc009756180, 0x3dc22c0, 0xc0009bc300, 0xc008719100, 0xc008719100, 0x0, 0x0)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/physical.go:46 +0x52
github.com/influxdata/flux/plan.(*planner).Plan(0xc009756360, 0x3dc22c0, 0xc0009bc300, 0xc008860630, 0x0, 0x0, 0x3d71f40)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/plan/builder.go:49 +0xce
github.com/influxdata/flux/lang.buildPlan(0x3dc22c0, 0xc0009bc300, 0xc008860630, 0xc00513b220, 0x0, 0x0, 0x0)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/lang/compiler.go:157 +0x325
github.com/influxdata/flux/lang.(*AstProgram).Start(0xc00513b270, 0x3dc22c0, 0xc0030c6240, 0xc00513b360, 0x0, 0x0, 0x0, 0x0)
/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.117.0/lang/compiler.go:500 +0x5c7
github.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery(0xc001908000, 0xc008e85800)
/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:480 +0x12f
github.com/influxdata/influxdb/v2/query/control.(*Controller).processQueryQueue(0xc001908000)
/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:438 +0x4e
github.com/influxdata/influxdb/v2/query/control.New.func1(0xc001908000)
/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:220 +0x59
created by github.com/influxdata/influxdb/v2/query/control.New
/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:218 +0x7e5
"
```
The associated requests. The goal is counting server up per group and compare to expected server up.
```
import "csv"
setup = csv.from(
csv: "
host,host_prefix,expect_up
service_a_01,service_a,1
service_a_02,service_a,1
service_b_01,service_b,2
service_b_02,service_b,2
service_b_01,service_b,2
",
mode: "raw"
)
source = from(bucket: "stat")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "cpu")
|> filter(fn: (r) => r["type_instance"] == "user")
|> filter(fn: (r) => r["_field"] == "percent_value")
|> map(fn: (r)=>({ r with _value: if exists(r._value) then 1 else 0 }))
|> aggregateWindow(every: v.windowPeriod, fn: min, createEmpty: false)
|> keep(columns: ["_time", "_value", "host"])
group_up = join(tables: {"source": source, "setup": setup}, on:["host"])
|> group(columns: ["host_prefix"])
|> aggregateWindow(every: v.windowPeriod, fn: sum, createEmpty: false)
join(tables: {"group_up": group_up, "setup": setup}, on:["host_prefix"])
```
I use:
- InfluxDB 2.0.7
- Server: 2a45f0c
- Frontend: 217d8c0
Contributor guide
Research direction
Start with the reproduced Flux request and the stack trace entry in plan/heuristic_planner.go:170, then read the surrounding heuristic planner logic and query/control/controller.go around lines 457 and 480. Confirm the request still triggers the inconsistent plan-graph panic and add a regression test that demonstrates the corrected planner behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100