From 9b2e2cc41f1dafa2cd17ea1022072235cbae38de Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Wed, 14 Sep 2016 08:52:58 +0100 Subject: [PATCH] kafka panic: Check that error is non-nil before fixes #1764 --- CHANGELOG.md | 1 + plugins/inputs/kafka_consumer/kafka_consumer.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 962752d4258f9..369b93361fbd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - [#1733](https://github.com/influxdata/telegraf/issues/1733): Fix statsd scientific notation parsing - [#1716](https://github.com/influxdata/telegraf/issues/1716): Sensors plugin strconv.ParseFloat: parsing "": invalid syntax - [#1530](https://github.com/influxdata/telegraf/issues/1530): Fix prometheus_client reload panic +- [#1764](https://github.com/influxdata/telegraf/issues/1764): Fix kafka consumer panic when nil error is returned down errs channel. ## v1.0 [2016-09-08] diff --git a/plugins/inputs/kafka_consumer/kafka_consumer.go b/plugins/inputs/kafka_consumer/kafka_consumer.go index 5600d82a49a2d..bdfce17f981b1 100644 --- a/plugins/inputs/kafka_consumer/kafka_consumer.go +++ b/plugins/inputs/kafka_consumer/kafka_consumer.go @@ -128,7 +128,9 @@ func (k *Kafka) receiver() { case <-k.done: return case err := <-k.errs: - log.Printf("Kafka Consumer Error: %s\n", err.Error()) + if err != nil { + log.Printf("Kafka Consumer Error: %s\n", err) + } case msg := <-k.in: metrics, err := k.parser.Parse(msg.Value) if err != nil {