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

Fix nil pointer error in knx_listener #9444

Merged
merged 3 commits into from Jul 1, 2021

Conversation

pheew
Copy link
Contributor

@pheew pheew commented Jun 28, 2021

Required for all PRs:

  • Updated associated README.md.
    (Don't think this is necessary but happy to make any changes if required)
  • Wrote appropriate unit tests.

The KNX input plugin crashes with a nil pointer dereference error when receiving subsequent messages for an ignored group address:

2021-06-28T18:19:19Z I! [inputs.KNXListener] Ignoring message {Command:Write Source:1.1.5 Destination:1/0/0 Data:[0]} for unknown GA "1/0/0",
panic: runtime error: invalid memory address or nil pointer dereference,
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x19680b8],
goroutine 11 [running]:,
github.com/influxdata/telegraf/plugins/inputs/knx_listener.(*KNXListener).listen(0xc00050a630),
	/go/src/github.com/influxdata/telegraf/plugins/inputs/knx_listener/knx_listener.go:158 +0x418,
github.com/influxdata/telegraf/plugins/inputs/knx_listener.(*KNXListener).Start.func1(0xc00050a630),
	/go/src/github.com/influxdata/telegraf/plugins/inputs/knx_listener/knx_listener.go:133 +0x48,
created by github.com/influxdata/telegraf/plugins/inputs/knx_listener.(*KNXListener).Start,
	/go/src/github.com/influxdata/telegraf/plugins/inputs/knx_listener/knx_listener.go:131 +0x497,

I narrowed it down to a faulty boolean check which makes it still try to process an ignored KNX message. The included unit test fails without the changes made.

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Jun 28, 2021
@pheew
Copy link
Contributor Author

pheew commented Jun 28, 2021

!signed-cla

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for tracking this down!

@srebhan srebhan added the area/iot New plugins or features relating to IoT monitoring label Jun 28, 2021
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the linter issue with the empty line at beginning of TestRegularReceives_MultipleMessages().

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jun 28, 2021
@MyaLongmire MyaLongmire merged commit 9b22161 into influxdata:master Jul 1, 2021
@pheew pheew deleted the fix/knx_listener branch July 1, 2021 20:47
reimda pushed a commit that referenced this pull request Jul 7, 2021
bhsu-ms pushed a commit to bhsu-ms/telegraf that referenced this pull request Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/iot New plugins or features relating to IoT monitoring fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants