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

Sudden close of Telegraf caused by OPC UA input plugin #10140

Closed
hybuild-project opened this issue Nov 21, 2021 · 2 comments · Fixed by #10230
Closed

Sudden close of Telegraf caused by OPC UA input plugin #10140

hybuild-project opened this issue Nov 21, 2021 · 2 comments · Fixed by #10230
Labels
area/opcua bug unexpected problem or unintended behavior platform/windows

Comments

@hybuild-project
Copy link

Relevent telegraf.conf

[[inputs.opcua]]
  name = "xyz"
  endpoint = "opc.tcp://xxx.yyy.wwww.zzz:4840"
  security_policy = "None"
  security_mode = "None"
  nodes = [
    { name="abc",  namespace="6",  identifier_type="s",  identifier="abc"},
    { name="def",  namespace="6",  identifier_type="s",  identifier="def"},
...
]

System info

Telegraf 1.20.3, Windows 10

Docker

No response

Steps to reproduce

  1. Simly running Telegraf with that plugin

...

Expected behavior

No errors

Actual behavior

After some random time (hours, one day at most) it crashes:

goroutine 68418 [running]:
github.com/gopcua/opcua/uasc.(*SecureChannel).dispatcher(0xc0007b8000)
/go/pkg/mod/github.com/gopcua/opcua@v0.2.0-rc2.0.20210409063412-baabb9b14fd2/uasc/secure_channel.go:208 +0x185
created by github.com/gopcua/opcua/uasc.(*SecureChannel).open.func1
/go/pkg/mod/github.com/gopcua/opcua@v0.2.0-rc2.0.20210409063412-baabb9b14fd2/uasc/secure_channel.go:496 +0x5f

Additional info

No response

@hybuild-project hybuild-project added the bug unexpected problem or unintended behavior label Nov 21, 2021
@R290
Copy link
Contributor

R290 commented Nov 23, 2021

I'm facing a similar issue after upgrading Telegraf to version 1.20.4:

2021-11-23T13:05:10Z E! [inputs.opcua] Error in plugin: RegisterNodes Read failed: The operation could not complete because the client is not connected to the server. StatusBadServerNotConnected (0x800D0000)
panic: send on closed channel

goroutine 8337 [running]:
github.com/gopcua/opcua/uasc.(*SecureChannel).dispatcher(0xc000cbec40)
        /go/pkg/mod/github.com/gopcua/opcua@v0.2.0-rc2.0.20210409063412-baabb9b14fd2/uasc/secure_channel.go:208 +0x185
created by github.com/gopcua/opcua/uasc.(*SecureChannel).open.func1
        /go/pkg/mod/github.com/gopcua/opcua@v0.2.0-rc2.0.20210409063412-baabb9b14fd2/uasc/secure_channel.go:496 +0x5f

There is an extra line at the beginning about sending on a closed channel. In my case this is caused by the PLC closing the TCP connection. Let me see if I can find out what changed between versions. Could be Telegraf itself or the gopcua library.

EDIT: downgrading to 1.19.3 avoids the panic for now. For later versions the gopcua library might need an update. There is a specific commit about this: gopcua/opcua@809fb04 included in v0.2.1 (Telegraf uses v0.2.0).

@hybuild-project
Copy link
Author

Very nice investigation R290! Let-s hope it will be included in v1.21...! Cheers and thank you so much.

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

Successfully merging a pull request may close this issue.

2 participants