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

Kuiper may panic when sendSingle is set to true but without specifying dataTemplate #416

Closed
novuscy opened this issue Aug 12, 2020 · 2 comments
Assignees

Comments

@novuscy
Copy link

novuscy commented Aug 12, 2020

here is the rule I created:

{
  "sql": "SELECT DynamicInfo from edgex_stream",
  "actions": [
    {
      "mqtt": {
        "server": "tcp://localhost:1883",
        "topic": "rules_test",
        "sendSingle": true
      }
    },
    {
      "log":{}
    }
  ]
}

here is the panic log:

time="2020-08-12T14:57:12+08:00" level=debug msg="receive 1 records" file="entry.go:314" rule=rule2
time="2020-08-12T14:57:12+08:00" level=debug msg=success file="entry.go:314" rule=rule2
time="2020-08-12T14:57:12+08:00" level=debug msg="broadcast from project to mqtt_0 done" file="entry.go:314" rule=rule2
time="2020-08-12T14:57:12+08:00" level=debug msg="broadcast from project to log_1 done" file="entry.go:314" rule=rule2
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x459805b]

goroutine 263 [running]:
text/template.errRecover(0xc000483c60)
	/usr/local/Cellar/go/1.14.3/libexec/src/text/template/exec.go:163 +0x1c2
panic(0x46ce420, 0x4d3c6d0)
	/usr/local/Cellar/go/1.14.3/libexec/src/runtime/panic.go:969 +0x166
text/template.(*Template).execute(0x0, 0x487ce60, 0xc0001f8570, 0x46c9440, 0xc0001f8540, 0x0, 0x0)
	/usr/local/Cellar/go/1.14.3/libexec/src/text/template/exec.go:217 +0x19b
text/template.(*Template).Execute(...)
	/usr/local/Cellar/go/1.14.3/libexec/src/text/template/exec.go:203
github.com/emqx/kuiper/xstream/nodes.doCollect(0x488f140, 0xc000138d20, 0xc0001fe4a0, 0x4893b00, 0xc00052c990, 0x3e8, 0xc0000a0100, 0x0, 0xc00053e3c0, 0x4898740, ...)
	/Users/novuscy/Projects/edgex/kuiper/xstream/nodes/sink_node.go:274 +0x5da
github.com/emqx/kuiper/xstream/nodes.(*SinkNode).Open.func1.1(0xc000519380, 0xc00032a360, 0x4898740, 0xc0001f44d0, 0x4897340, 0xc0001f4380, 0xc00002b428, 0xc00002b430, 0xc00002b418, 0xc00002b420, ...)
	/Users/novuscy/Projects/edgex/kuiper/xstream/nodes/sink_node.go:204 +0x4cc
created by github.com/emqx/kuiper/xstream/nodes.(*SinkNode).Open.func1
	/Users/novuscy/Projects/edgex/kuiper/xstream/nodes/sink_node.go:158 +0x620

I think some boundary check is needed, or maybe just ignore the sendSingle value when dataTemplate is not specified?

@jinfahua
Copy link
Collaborator

@novuscy thanks for your report, we'll investigate see if it's necessary to add validation against the settings.

@jinfahua jinfahua self-assigned this Aug 19, 2020
ngjaying pushed a commit that referenced this issue Aug 21, 2020
@jinfahua
Copy link
Collaborator

Fixed & close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants