influxdata / influxdata/kapacitor
kapacitor UDF crashes if empty protobuf response is sent.
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
e.g. in moving_avg.py example. Change the point function to return
```
resp = udf_pb2.Response()
self._agent.write_response(resp)
```
and kapacitor will panic and crash when it sends a point to the UDF:
```
ts=2018-08-27T18:03:48.232Z lvl=info msg="UDF log" service=kapacitor task_master=main task_master=6e6c757c-7f69-4644-a411-4593908a373d task=udf_avg node=pyavg2 text="2018-08-27 18:03:48,232 INFO:root: Starting Agent"
panic: unexpected response message
goroutine 212 [running]:
github.com/influxdata/kapacitor/udf.(*Server).handleResponse(0xc420104160, 0xc42048c120, 0x0, 0x0)
/root/go/src/github.com/influxdata/kapacitor/udf/server.go:757 +0x122d
github.com/influxdata/kapacitor/udf.(*Server).readData(0xc420104160, 0x0, 0x0)
/root/go/src/github.com/influxdata/kapacitor/udf/server.go:658 +0x98
github.com/influxdata/kapacitor/udf.(*Server).Start.func2(0xc420104160)
/root/go/src/github.com/influxdata/kapacitor/udf/server.go:165 +0x2f
created by github.com/influxdata/kapacitor/udf.(*Server).Start
/root/go/src/github.com/influxdata/kapacitor/udf/server.go:164 +0x167
```
adding anything at all to the response object seems to prevent it:
``` resp = udf_pb2.Response()
resp.point.fieldsDouble["name here"] = 1.0
self._agent.write_response(resp)
```
Contributor guide
Research direction
Start in udf/server.go at Server.handleResponse and Server.readData, using the stack-trace locations as entry points. Reproduce the issue with the moving_avg.py example and an empty udf_pb2.Response; done means Kapacitor no longer panics on that response while the existing non-empty response behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100