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(inputs.opcua_listener): Avoid segfault if subscription was not successful #13742

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

srebhan
Copy link
Contributor

@srebhan srebhan commented Aug 9, 2023

Fix case where the client stops without finishing the subscription

023-08-09T12:39:47Z D! [inputs.opcua_listener] Opc Subscribe Stopped
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x2fb91ec]

goroutine 27 [running]:
github.com/gopcua/opcua.(*Subscription).Cancel(0x0, {0x80afc80, 0xc0024351d0})
        /home/sven/go/pkg/mod/github.com/gopcua/opcua@v0.4.0/subscription.go:86 +0x4c
github.com/influxdata/telegraf/plugins/inputs/opcua_listener.(*SubscribeClient).Stop(0xc000782340, {0x80afc80, 0xc0024351d0})
        /home/sven/Development/InfluxData/telegraf/plugins/inputs/opcua_listener/subscribe_client.go:82 +0x72
github.com/influxdata/telegraf/plugins/inputs/opcua_listener.(*OpcUaListener).Stop(0xc000330900)
        /home/sven/Development/InfluxData/telegraf/plugins/inputs/opcua_listener/opcua_listener.go:62 +0x6f
github.com/influxdata/telegraf/agent.stopServiceInputs({0xc000012170, 0x1, 0x0?})
        /home/sven/Development/InfluxData/telegraf/agent/agent.go:529 +0x66
github.com/influxdata/telegraf/agent.(*Agent).testRunInputs(0xc0007b22a8, {0x80afc10, 0xc002376690}, 0x0?, 0xc000de3aa0)
        /home/sven/Development/InfluxData/telegraf/agent/agent.go:519 +0x27f
github.com/influxdata/telegraf/agent.(*Agent).runTest.func4()
        /home/sven/Development/InfluxData/telegraf/agent/agent.go:1053 +0x6c
created by github.com/influxdata/telegraf/agent.(*Agent).runTest
        /home/sven/Development/InfluxData/telegraf/agent/agent.go:1051 +0x665

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Aug 9, 2023
@srebhan srebhan added area/opcua ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Aug 9, 2023
@powersj powersj merged commit 96a9597 into influxdata:master Aug 9, 2023
23 checks passed
@github-actions github-actions bot added this to the v1.27.4 milestone Aug 9, 2023
powersj pushed a commit that referenced this pull request Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/opcua fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins 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

2 participants