influxdata / influxdb

Scalable datastore for metrics, events, and real-time analytics
https://influxdata.com
Apache License 2.0
29.08k stars 3.56k forks source link

"panic: length of stream not supported" with json.encode #20928

Open mattcarp12 opened 3 years ago

mattcarp12 commented 3 years ago

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

Run flux script like such:

import "http"
import "json"
data = from(bucket: "canopy")
    |> range(start: -10s)
    |> filter(fn: (r) => r["_measurement"] == "amqp_consumer")
    |> filter(fn: (r) => r["host"] == "jetson1")
    |> filter(fn: (r) => r["_field"] == "class_id")
    |> map(fn: (r) => ({r with _value: 1.0 - r._value}))
    |> mean()

http.post(url: "http://webapp:5000/allenbradley", headers: {}, data: json.encode(v: data[0]))

Expected behavior: Successfully send the HTTP post request

Actual behavior: Receive " An internal error has occurred" message in query window and the following message in influxdb logs:

ts=2021-03-11T19:59:42.883623Z lvl=info msg="panic during program start" log_id=0SpijqP0000 service=storage-reads error="panic: length of stream not supported" stacktrace="goroutine 135 [running]:\nruntime/debug.Stack(0xc0006e66c0, 0x0, 0x27794f1)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x9f\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery.func1(0xc00388cd80, 0xc0004f07e0)\n\t/go/src/github.com/influxdata/influxdb/query/control/controller.go:424 +0x153\npanic(0x22c6e20, 0x39b6980)\n\t/usr/local/go/src/runtime/panic.go:969 +0x1b9\ngithub.com/influxdata/flux.(*TableObject).Len(0xc000ef8300, 0x3a76e60)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/compile.go:192 +0x39\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doExpression(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a59980, 0xc000e32980, 0x3a6bca0, 0xc0039d4c00, 0x18, 0x24beb00, 0xc0039d4c00, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:361 +0x22da\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doArguments.func1(0xc004056a80, 0xc004056a80, 0x3a47be0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:734 +0x205\ngithub.com/influxdata/flux/values.BuildObjectWithSize(0x0, 0xc00192ca10, 0x1, 0x1, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/values/object.go:114 +0xcf\ngithub.com/influxdata/flux/values.BuildObject(...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/values/object.go:101\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doArguments(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc000e32a00, 0x3a6bca0, 0xc0039d4c00, 0xc0039d4c05, 0x3a1d420, 0xc0004ebba0, 0x0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:729 +0x185\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doCall(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc000120400, 0x3a6bca0, 0xc0039d4c00, 0x7f1035382b10, 0xc00177d680, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:661 +0x3a6\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doExpression(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a59680, 0xc000120400, 0x3a6bca0, 0xc0039d4c00, 0x7f1035382b10, 0xc00177d680, 0x0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:336 +0x1b7b\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doArguments.func1(0xc004056220, 0xc004056220, 0x2)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:734 +0x205\ngithub.com/influxdata/flux/values.BuildObjectWithSize(0x0, 0xc00192d210, 0x3, 0x3, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/values/object.go:114 +0xcf\ngithub.com/influxdata/flux/values.BuildObject(...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/values/object.go:101\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doArguments(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc000e32a80, 0x3a6bca0, 0xc0039d4c00, 0xc0039d4c05, 0x3a1d420, 0xc0004eb780, 0x0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:729 +0x185\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doCall(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc001642680, 0x3a6bca0, 0xc0039d4c00, 0xc000b49a10, 0x6, 0x0, 0x1)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:661 +0x3a6\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doExpression(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a59680, 0xc001642680, 0x3a6bca0, 0xc0039d4c00, 0xc000ef8300, 0x0, 0x0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:336 +0x1b7b\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doStatement(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a4eae0, 0xc000fa7950, 0x3a6bca0, 0xc0039d4c00, 0x3a71700, 0xc000ef8300, 0x0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:171 +0x448\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doFile(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc006ddf200, 0x3a6bca0, 0xc0039d4c00, 0x39f6860, 0xc000b49400, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:111 +0x1d4\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doPackage(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0xc0018d8770, 0x3a6bca0, 0xc0039d4c00, 0x39f6860, 0xc000b49400, 0xc003372158, 0x7f103ec38630)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:94 +0xc5\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doRoot(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a47ea0, 0xc0018d8770, 0x3a6bca0, 0xc0039d4c00, 0x39f6860, 0xc000b49400, 0x2741f01, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:84 +0x255\ngithub.com/influxdata/flux/interpreter.(*Interpreter).Eval(0xc004732e80, 0x3a46ba0, 0xc000b2a840, 0x3a47ea0, 0xc0018d8770, 0x3a6bca0, 0xc0039d4c00, 0x39f6860, 0xc000b49400, 0x25341e0, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/interpreter/interpreter.go:75 +0x99\ngithub.com/influxdata/flux/runtime.(*runtime).Eval(0x6093820, 0x3a46ba0, 0xc000b2a840, 0x3a1d6e0, 0xc004fd4050, 0x3a1d6a0, 0x60cbf08, 0xc000b49340, 0x2, 0x2, ...)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/runtime/runtime.go:140 +0x226\ngithub.com/influxdata/flux/lang.(*AstProgram).getSpec(0xc000fa6410, 0x3a46ba0, 0xc000b2a7b0, 0xc000fa6500, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/lang/compiler.go:440 +0x27f\ngithub.com/influxdata/flux/lang.(*AstProgram).Start(0xc000fa6410, 0x3a46ba0, 0xc000b2a6f0, 0xc000fa6500, 0x0, 0x0, 0x0, 0x0)\n\t/go/pkg/mod/github.com/influxdata/flux@v0.99.0/lang/compiler.go:477 +0x1c7\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery(0xc0004f07e0, 0xc00388cd80)\n\t/go/src/github.com/influxdata/influxdb/query/control/controller.go:447 +0x12f\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).processQueryQueue(0xc0004f07e0)\n\t/go/src/github.com/influxdata/influxdb/query/control/controller.go:405 +0x4c\ngithub.com/influxdata/influxdb/v2/query/control.New.func1(0xc0004f07e0)\n\t/go/src/github.com/influxdata/influxdb/query/control/controller.go:208 +0x57\ncreated by github.com/influxdata/influxdb/v2/query/control.New\n\t/go/src/github.com/influxdata/influxdb/query/control/controller.go:206 +0x7ac\n"

Environment info:

Linux docker container, Influx 2.0

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

AnunnakiSelva commented 3 years ago

is there any solution for this ?

Ruakij commented 2 years ago

Also happens when using contains()

Example:

bssids = from(bucket: "rfmon")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "rfmon_signal_dbm")
  |> group(columns: ["bssid"])
  |> first()
  |> group()
  |> keep(columns: ["bssid"])

from(bucket: "rfmon")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "rfmon_signal_dbm")
  |> filter(fn: (r) => contains(value: r["srcmac"], set: bssids))

Error in console:

influxdb      | ts=2021-12-08T19:58:11.453901Z lvl=info msg="panic during program start" log_id=0YIaAuFl000 service=storage-reads error="panic: length of stream not supported" stacktrace="goroutine 918 [running]:\nruntime/debug.Stack()\n\t/home/circleci/.tools/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery.func1()\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:457 +0x125\npanic({0x3b69c00, 0x400b868})\n\t/home/circleci/.tools/go/src/runtime/panic.go:1038 +0x215\ngithub.com/influxdata/flux.(*TableObject).Len(0xc010ea0638)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/compile.go:192 +0x27\ngithub.com/influxdata/flux/interpreter.resolveValue({0x40f45f8, 0xc01122eb80})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1222 +0x3da\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7c28, 0xc0048c1570}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1032 +0x152e\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7f00, 0xc033df1b00}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1161 +0x948\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7e20, 0xc01122ef80}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1136 +0x110b\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7988, 0xc0110c4f30}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1073 +0x2ef\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7f70, 0xc03f4165a0}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1060 +0x1028\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a78e0, 0xc033df1980}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1041 +0x11f0\ngithub.com/influxdata/flux/interpreter.ResolveIdsInFunction({0x40e7ca8, 0xc0243fbaa0}, 0xc0110a5980, {0x40a7b48, 0xc01122ef00}, 0xc010ea1088)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:1080 +0x5e5\ngithub.com/influxdata/flux/interpreter.function.Resolve({0xc0110a5980, {0x40e7ca8, 0xc0243fbaa0}, 0xc03e5d8a40})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:975 +0xa5\ngithub.com/influxdata/flux/interpreter.ResolveFunction({0x40f6708, 0xc0360613e0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:933 +0x50\ngithub.com/influxdata/flux/stdlib/universe.createFilterOpSpec({{0x40fd988, 0xc0110a7e48}}, 0xc0003278e0)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/stdlib/universe/filter.go:68 +0x191\ngithub.com/influxdata/flux.(*function).call(0xc0003eaa80, {0x40a6bc0, 0xc0244083c0}, {0x40fd988, 0xc0110a7e48})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/compile.go:312 +0x10e\ngithub.com/influxdata/flux/interpreter.DoFunctionCallContext(0xc010ea1348, {0x40a6bc0, 0xc0244083c0}, {0x40fa360, 0xc03f4162d0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:645 +0x10b\ngithub.com/influxdata/flux.(*function).Call(0x0, {0x40a6bc0, 0xc0244083c0}, {0x40fa360, 0xc03f4162d0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/compile.go:301 +0x49\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doCall(0xc03e5d8a40, {0x40a6bc0, 0xc0243ea690}, 0xc0110c4ab0, {0x40e7ca8, 0xc0243fbaa0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:686 +0x4e3\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doExpression(0xc03e5d8a40, {0x40a6bc0, 0xc0243ea690}, {0x40b7ed0, 0xc0110c4ab0}, {0x40e7ca8, 0xc0243fbaa0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:336 +0x129f\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doStatement(0xc03e5d8a40, {0x40a6bc0, 0xc0243ea690}, {0x40b2df8, 0xc03f3fb5e0}, {0x40e7ca8, 0xc0243fbaa0})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:171 +0x245\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doFile(0xc03e5d8a40, {0x40a6bc0, 0xc0243ea690}, 0xc0110a5380, {0x40e7ca8, 0xc0243fbaa0}, {0x404faa0, 0xc012753240})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:111 +0x19b\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doPackage(0x5, {0x40a6bc0, 0xc0243ea690}, 0x415bb4, {0x40e7ca8, 0xc0243fbaa0}, {0x404faa0, 0xc012753240})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:94 +0xbe\ngithub.com/influxdata/flux/interpreter.(*Interpreter).doRoot(0xc001400000, {0x40a6bc0, 0xc0243ea690}, {0x40a7e90, 0xc008d00af0}, {0x40e7ca8, 0xc0243fbaa0}, {0x404faa0, 0xc012753240})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:84 +0xbf\ngithub.com/influxdata/flux/interpreter.(*Interpreter).Eval(0xc03e5d8a40, {0x40a6bc0, 0xc0243ea690}, {0x40a7e90, 0xc008d00af0}, {0x40e7ca8, 0xc0243fbaa0}, {0x404faa0, 0xc012753240})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/interpreter/interpreter.go:75 +0x5e\ngithub.com/influxdata/flux/runtime.(*runtime).Eval(0xae745c0, {0x40a6bc0, 0xc0243ea690}, {0x4076110, 0xc009969e10}, {0x406c9f0, 0xaeaf4d8}, {0xc012753180, 0x2, 0x2})\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/runtime/runtime.go:119 +0x1fe\ngithub.com/influxdata/flux/lang.(*AstProgram).getSpec(0xc03e181ef0, {0x40a6bc0, 0xc0243ea660}, 0x400bbf8)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/lang/compiler.go:447 +0x224\ngithub.com/influxdata/flux/lang.(*AstProgram).Start(0xc03e181ef0, {0x40a6bc0, 0xc0243ea510}, 0xc00ee6376c)\n\t/home/circleci/go/pkg/mod/github.com/influxdata/flux@v0.139.0/lang/compiler.go:484 +0x191\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).executeQuery(0xc00ee63778, 0xc0110bc180)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:480 +0x226\ngithub.com/influxdata/influxdb/v2/query/control.(*Controller).processQueryQueue(0xc01221e000)\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:438 +0x2e\ngithub.com/influxdata/influxdb/v2/query/control.New.func1()\n\t/home/circleci/go/src/github.com/influxdata/influxdb/query/control/controller.go:220 +0x5d\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 +0xa1b\n"
influxdb      | ts=2021-12-08T19:58:11.454187Z lvl=warn msg="internal error not returned to client" log_id=0YIaAuFl000 handler=error_logger error="panic: length of stream not supported"