opcua
opcua copied to clipboard
Segfault after reconnect (using structured data)
Description In a setup working against a Siemens S7-1500, using user-defined structures, we have seen rare crashes that seem to be caused by a memory management issue (double free) within the UA SDK client.
To Reproduce We have not been able to reliably reproduce the behavior.
This might be connected to the missing type dictionary?! Not sure.
Screenshots Here's a trace of one of these occasions:
[ 2023-07-18T18:38:56 ]
Cannot get a structure definition for 0 - check access to type dictionary
OPC UA session 31TNTR-PLC-5000-Session: (requestWrite) beginWrite service failed with status BadInvalidArgument
OPC UA session 31TNTR-PLC-5000-Session: (requestWrite) beginWrite service failed with status BadConnectionClosed
OPC UA session 31TNTR-PLC-5000-Session: (requestWrite) beginWrite service failed with status BadConnectionClosed
OPC UA session 31TNTR-PLC-5000-Session: (requestWrite) beginWrite service failed with status BadConnectionClosed
OPC UA session 31TNTR-PLC-5000-Session: (requestWrite) beginWrite service failed with status BadConnectionClosed
OPC UA session 31TNTR-PLC-5000-Session: connection status changed from Connected to ConnectionErrorApiReconnect
OPC UA session 31TNTR-PLC-5000-Session: connection status changed from ConnectionErrorApiReconnect to Connected
OPC UA session 31TNTR-PLC-5000-Session: connected as 'Anonymous' (sec-mode: None; sec-policy: None)
OPC UA session 31TNTR-PLC-5000-Session: WARNING - this session uses *** NO SECURITY ***
*** Error in `/home/codac-dev/AGV/Project-AGV/m-VAC-TKM-TCP5/target/main/epics/bin/linux-x86_64/PLC': double free or corruption (!prev): 0x00007f2ae8057ce0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7c619)[0x7f2bc7928619]
/opt/codac-6.3/lib/libuastack.so(OpcUa_ByteString_Clear+0x1a)[0x7f2bc67dec1a]
/opt/codac-6.3/lib/libuastack.so(OpcUa_ExtensionObject_Clear+0x89)[0x7f2bc67dfc39]
/opt/codac-6.3/lib/libuastack.so(OpcUa_ExtensionObject_Delete+0x1e)[0x7f2bc67dfc9e]
/opt/codac-6.3/lib/libuastack.so(OpcUa_Variant_Clear+0x125)[0x7f2bc67dffa5]
/opt/codac-6.3/lib/libuabase.so(_ZN9UaVariantaSERKS_+0x17)[0x7f2bc6b244b7]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua16DataElementUaSdk15setIncomingDataERK9UaVariantNS_13ProcessReasonEPKSs+0x2f)[0x7f2bc8e9f17f]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua16DataElementUaSdk15setIncomingDataERK9UaVariantNS_13ProcessReasonEPKSs+0x794)[0x7f2bc8e9f8e4]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua16DataElementUaSdk15setIncomingDataERK9UaVariantNS_13ProcessReasonEPKSs+0x794)[0x7f2bc8e9f8e4]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua16DataElementUaSdk15setIncomingDataERK9UaVariantNS_13ProcessReasonEPKSs+0x794)[0x7f2bc8e9f8e4]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua9ItemUaSdk15setIncomingDataERK16_OpcUa_DataValueNS_13ProcessReasonE+0x1b8)[0x7f2bc8e98388]
/opt/codac-6.3/epics/lib/linux-x86_64/libopcua.so.0.9.2(_ZN8DevOpcua17SubscriptionUaSdk10dataChangeEjRK28UaMonitoredItemNotificationsRK17UaDiagnosticInfos+0x76)[0x7f2bc8e94ba6]
/opt/codac-6.3/lib/libuaclient.so(_ZN11UaClientSdk16UaSessionPrivate25doRepublishAfterReconnectEv+0x61f)[0x7f2bc9af252f]
/opt/codac-6.3/lib/libuaclient.so(_ZN11UaClientSdk16UaSessionPrivate14doTryReconnectEv+0x2b0)[0x7f2bc9af2ea0]
/opt/codac-6.3/lib/libuaclient.so(_ZN11UaClientSdk16UaSessionPrivate3runEv+0x108)[0x7f2bc9af3798]
/opt/codac-6.3/lib/libuastack.so(InternalThreadMain+0x18)[0x7f2bc676e228]
/opt/codac-6.3/lib/libuastack.so(pthread_start+0x27)[0x7f2bc677a6d7]
/lib64/libpthread.so.0(+0x7e25)[0x7f2bc7697e25]
/lib64/libc.so.6(clone+0x6d)[0x7f2bc79a434d]
======= Memory map: ========
00400000-00408000 r-xp 00000000 fd:00 11010242 /home/codac-dev/AGV/Project-AGV/m-VAC-TKM-TCP5/target/main/epics/bin/linux-x86_64/PLC
00607000-00608000 r--p 00007000 fd:00 11010242 /home/codac-dev/AGV/Project-AGV/m-VAC-TKM-TCP5/target/main/epics/bin/linux-x86_64/PLC
00608000-00609000 rw-p 00008000 fd:00 11010242 /home/codac-dev/AGV/Project-AGV/m-VAC-TKM-TCP5/target/main/epics/bin/linux-x86_64/PLC
00609000-0060a000 rw-p 00000000 00:00 0
01b1c000-05937000 rw-p 00000000 00:00 0 [heap]
Setup
- OPC UA Support: 0.9.2
- Platform: RHEL 7.4
- EPICS Base: 7.0.4.1
- Client library: UA SDK 1.5.5
- Server: S7-1500