Closed jeffsparks closed 2 years ago
@jeffsparks @henjoe Can you both test with the latest version of Telegraf.
Looks like #9551 #9524 #9583 have all been merged since this issue was opened.
Hello Thanks for this. Will try to test it.
I will test again but it will take a few days
I think the only way this can panic at https://github.com/gopcua/opcua/blob/v0.1.13/ua/node_id.go#L396-L398 is if the node id is nil
. n.mask
will then panic.
Maybe something going wrong in RegisterNodes
?
I would suggest to not register nodes unless you know that it is supported by the OPC/UA server and that you can handle the auto-reconnect case where the session might invalidate the registered node id. In any case, registered reads are performance optimization for very high-volume, very high-frequency reads and not needed IMHO for normal data collection.
See https://github.com/gopcua/opcua/issues/557 and https://github.com/gopcua/opcua/issues/478
Also, please test this with the latest gopcua version which at this moment is v0.3.1. It is very different from v0.1.13
Any update on this issue. I am using telegraf v1.23.0 and have attempted to connect to the GE iFix OPC UA Server and Kepware both of which produce this error.
*Edit This was a problem with my config I had set the identifier_type="i" and was using a string identifier. It works correctly now.
*Edit
Looking at the config file above it has the same issue.
{name="datetime_test", namespace="0", identifier_type="i", identifier="F1002LPN_Filler1.PLC_Admin.PLCDateTime_005", data_type="int",description="test"}
Should be
{name="datetime_test", namespace="0", identifier_type="s", identifier="F1002LPN_Filler1.PLC_Admin.PLCDateTime_005", data_type="int",description="test"}
Any update on this issue. I am using telegraf v1.23.0 and have attempted to connect to the GE iFix OPC UA Server and Kepware both of which produce this error.
Yes. Same issue. My kepware is 6.12.325 (Latest Version), and telegraf 1.23.2. The identifier_type="s" is collected while identifier_type="i" is invalid memory address errors.
Relevant telegraf.conf:
System info:
Telegraf 1.18.1 Ubuntu Server
Docker
Steps to reproduce:
Expected behavior:
Full disclaimer: I haven't got it to work yet, but due to error message I don't think it is related to my configuration
Actual behavior:
jeff@ubuntu-server:~$ sudo telegraf --config /etc/telegraf/telegraf.conf 2021-04-21T14:19:53Z I! Starting Telegraf 1.18.1 2021-04-21T14:19:53Z I! Loaded inputs: cpu disk diskio kernel mem opcua processes swap system 2021-04-21T14:19:53Z I! Loaded aggregators: 2021-04-21T14:19:53Z I! Loaded processors: 2021-04-21T14:19:53Z I! Loaded outputs: influxdb_v2 2021-04-21T14:19:53Z I! Tags enabled: host=ubuntu-server 2021-04-21T14:19:53Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"ubuntu-server", Flush Interval:10s panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1a11bf2]
goroutine 51 [running]: github.com/gopcua/opcua/ua.(NodeID).Encode(0x0, 0x39a5a00, 0x0, 0x7fe56d37fac0, 0x0, 0x0) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/node_id.go:398 +0x52 github.com/gopcua/opcua/ua.encode(0x39a5a00, 0xc000010770, 0x196, 0xc000545980, 0x2b, 0xc000010770, 0x196, 0x8, 0xc000c615b8, 0x30e314b) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:46 +0xccf github.com/gopcua/opcua/ua.writeSlice(0x32e05c0, 0xc00024d928, 0x197, 0xc000545950, 0x28, 0x457814, 0x28, 0xc000545950, 0x28, 0xc000545950) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:131 +0x2ea github.com/gopcua/opcua/ua.encode(0x32e05c0, 0xc00024d928, 0x197, 0xc000545950, 0x28, 0xc00024d928, 0x197, 0xc000545950, 0x28, 0x0) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:85 +0xa87 github.com/gopcua/opcua/ua.writeStruct(0x36a1980, 0xc00024d920, 0x199, 0x31102e0, 0x18, 0x3506d38, 0x203000, 0x307c368, 0x203000, 0x306dc23) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:99 +0x258 github.com/gopcua/opcua/ua.encode(0x36a1980, 0xc00024d920, 0x199, 0x31102e0, 0x18, 0x199, 0x465dd3, 0x3471f00, 0x0, 0xc0002f41a0) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:83 +0xb31 github.com/gopcua/opcua/ua.encode(0x3506d00, 0xc00024d920, 0x16, 0x31102e0, 0x18, 0xc000c616c8, 0x4, 0xc000c616e0, 0x7fe56d3987a0, 0xc000bd5808) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:81 +0x993 github.com/gopcua/opcua/ua.Encode(0x3506d00, 0xc00024d920, 0xc00024d920, 0x0, 0x0, 0x0, 0x4) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/encode.go:34 +0x118 github.com/gopcua/opcua/ua.(Buffer).WriteStruct(0xc000bd5958, 0x3506d00, 0xc00024d920) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/ua/buffer.go:306 +0x67 github.com/gopcua/opcua/uasc.(Message).Encode(0xc00024d9a0, 0x428ed88, 0xc00024d920, 0xc000000004, 0xc000c243c0, 0x12a05f200) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/message.go:125 +0x136 github.com/gopcua/opcua/uasc.(SecureChannel).sendAsyncWithTimeout(0xc0002ed8c0, 0x428ed88, 0xc00024d920, 0xc000000004, 0xc000c12120, 0xc000c243c0, 0x1a3d301, 0x12a05f200, 0xc000c243c0, 0x12a05f200, ...) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:701 +0x133 github.com/gopcua/opcua/uasc.(SecureChannel).sendRequestWithTimeout(0xc0002ed8c0, 0x428ed88, 0xc00024d920, 0x4, 0xc000c12120, 0xc000c243c0, 0x12a05f200, 0xc000bd5c90, 0x0, 0x0) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:622 +0xb7 github.com/gopcua/opcua/uasc.(SecureChannel).SendRequestWithTimeout(0xc0002ed8c0, 0x428ed88, 0xc00024d920, 0xc000c243c0, 0x12a05f200, 0xc000bd5c90, 0x8, 0x3506d80) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/uasc/secure_channel.go:681 +0xcf github.com/gopcua/opcua.(Client).sendWithTimeout(0xc00057a850, 0x428ed88, 0xc00024d920, 0x12a05f200, 0xc000bd5c90, 0x410a38, 0x20) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:451 +0xbb github.com/gopcua/opcua.(Client).Send(...) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:437 github.com/gopcua/opcua.(Client).RegisterNodes(0xc00057a850, 0xc00024d920, 0xc000bc6240, 0x0, 0x0) /go/pkg/mod/github.com/gopcua/opcua@v0.1.13/client.go:552 +0x8f github.com/influxdata/telegraf/plugins/inputs/opcua.Connect(0xc000442c00, 0x0, 0x0) /go/src/github.com/influxdata/telegraf/plugins/inputs/opcua/opcua_client.go:410 +0x315 github.com/influxdata/telegraf/plugins/inputs/opcua.(OpcUA).Gather(0xc000442c00, 0x42ddd18, 0xc00056a040, 0x34, 0x0) /go/src/github.com/influxdata/telegraf/plugins/inputs/opcua/opcua_client.go:503 +0x56c github.com/influxdata/telegraf/models.(RunningInput).Gather(0xc0005ba870, 0x42ddd18, 0xc00056a040, 0x2ee6000, 0x7ffff000) /go/src/github.com/influxdata/telegraf/models/running_input.go:117 +0x6d github.com/influxdata/telegraf/agent.(Agent).gatherOnce.func1(0xc00050f440, 0xc0005ba870, 0x42ddd18, 0xc00056a040) /go/src/github.com/influxdata/telegraf/agent/agent.go:491 +0x3f created by github.com/influxdata/telegraf/agent.(*Agent).gatherOnce /go/src/github.com/influxdata/telegraf/agent/agent.go:490 +0xb2
Additional info:
I havne't gotten the OPCUA plugin to work yet but I tried various combinations of settings to confirm it isn't simple configuration error. I think the issue might originate in the gopcua but I will look into it.