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

Telegraf 1.3 dev socket_writer Plugin (built from master) seg faults with value format #2541

Closed
RandyAbernethy opened this issue Mar 17, 2017 · 2 comments
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@RandyAbernethy
Copy link

RandyAbernethy commented Mar 17, 2017

Bug report

Telegraf socket_writer Plugin (built from commit 426182b) seg faults with value format when messages are received. Using the below config with with json format works fine (from 1 up to a max of about 36k mps on the test system). Switching to value causes a crash on the first message (see below scenario and output). There is no value OUTPUT FORMAT documented but log WARN or ERR message would be preferable.

Relevant telegraf.conf:

user@ubuntu:~/monitoring/msg-agg/telegraf$ cat local.conf 
[agent]
  interval = "15ms"
  flush_interval = "50ms"
  omit_hostname = true

[[inputs.socket_listener]]
  service_address = "tcp://:8094"
  name_override = "a"
  data_format = "value"
  data_type = "string"

[[outputs.socket_writer]]
  address = "tcp://192.168.131.133:9911"
  data_format = "value"
  
user@ubuntu:~/monitoring/msg-agg/telegraf$ 

System info:

user@ubuntu:~/monitoring/msg-agg/telegraf$ cat dockerfile 
FROM golang:1.8.0-alpine

RUN apk update
RUN apk add --no-cache iputils ca-certificates && \
    update-ca-certificates

RUN apk add git make
RUN go get github.com/influxdata/telegraf
WORKDIR $GOPATH/src/github.com/influxdata/telegraf
RUN make

EXPOSE 8094

CMD ["telegraf"]

Steps to reproduce:

user@ubuntu:~/monitoring/msg-agg/telegraf$ docker run -p 8094:8094 -v $PWD/local.conf:/etc/telegraf/telegraf.conf:ro msg-agg-tg
2017/03/17 00:33:37 I! Using config file: /etc/telegraf/telegraf.conf
2017-03-17T00:33:37Z I! Starting Telegraf (version dev-86-g426182b8)
2017-03-17T00:33:37Z I! Loaded outputs: socket_writer
2017-03-17T00:33:37Z I! Loaded inputs: inputs.socket_listener
2017-03-17T00:33:37Z I! Tags enabled: 
2017-03-17T00:33:37Z I! Agent Config: Interval:15ms, Quiet:false, Hostname:"", Flush Interval:50ms 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xf247f0]

goroutine 740 [running]:
github.com/influxdata/telegraf/plugins/outputs/socket_writer.(*SocketWriter).Write(0xc4201f9dd0, 0xc420010700, 0x1, 0x1, 0xc42030ae78, 0x64acd6)
	/go/src/github.com/influxdata/telegraf/plugins/outputs/socket_writer/socket_writer.go:78 +0x60
github.com/influxdata/telegraf/internal/models.(*RunningOutput).write(0xc4201ba460, 0xc420010700, 0x1, 0x1, 0x1, 0x0)
	/go/src/github.com/influxdata/telegraf/internal/models/running_output.go:173 +0xa1
github.com/influxdata/telegraf/internal/models.(*RunningOutput).Write(0xc4201ba460, 0x128ff80, 0xc4200105d0)
	/go/src/github.com/influxdata/telegraf/internal/models/running_output.go:157 +0x497
github.com/influxdata/telegraf/agent.(*Agent).flush.func1(0xc4200105d0, 0xc4201ba460)
	/go/src/github.com/influxdata/telegraf/agent/agent.go:238 +0x59
created by github.com/influxdata/telegraf/agent.(*Agent).flush
	/go/src/github.com/influxdata/telegraf/agent/agent.go:243 +0xa5

Expected behavior:

should work

Actual behavior:

blows up

Additional info:

When the conf format is changed to json all is well

Use case: [Why is this important (helps with prioritizing requests)]

Would be nice to be able to opt out of the JSON stuff like you can on the input side with the "value" format, or better yet a raw format.

@danielnelson danielnelson added this to the 1.3.0 milestone Mar 17, 2017
@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Mar 17, 2017
@danielnelson
Copy link
Contributor

Thanks for opening this issue. I'm not sure a value output format would make much sense because the value format doesn't have a time or measurement name.

@RandyAbernethy
Copy link
Author

We could use it in cases where telegraf is aggregating and we want raw unformatted data passed through. Not a deal killer though. On the other hand I think a segfault is a little user hostile even if it is not something the community wants to add support for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants