I have an OPC server application which works flawlessly when running inside Visual Studio, but when running the release build sometimes when a session is closed the application crashes due to heap corruption. Using OpenSSL 1.1.1k and calling UA_Server_run_iterate(server, false) every 100ms from main application thread.
Background Information / Reproduction Steps
Happening randomly but regularly. Sessions are using Basic256Sha256, SignAndEncrypt with username/password authentication.
Trace log when working:
06/04/2021 20:16:43.682 : Connection 33276 | SecureChannel 4 | Sending response for RequestId 31 of type CloseSessionResponse
06/04/2021 20:16:43.733 : Connection 33276 | Activity on the socket
06/04/2021 20:16:43.734 : Connection 33276 | Received a packet.
06/04/2021 20:16:43.735 : Connection 33276 | SecureChannel 4 | Verifying chunk signature
06/04/2021 20:16:43.738 : Connection 33276 | SecureChannel 4 | Calculated padding size to be 7
06/04/2021 20:16:43.740 : Connection 33276 | SecureChannel 4 | Process a CLO
06/04/2021 20:16:43.741 : Connection 33276 | SecureChannel 4 | CloseSecureChannel
06/04/2021 20:16:43.842 : Connection 33276 | Activity on the socket
06/04/2021 20:16:43.847 : Connection 33276 | Closed
Trace log when not working:
06/04/2021 20:18:54.497 : Connection 572 | SecureChannel 8 | Sending response for RequestId 31 of type CloseSessionResponse
06/04/2021 20:18:54.597 : Connection 572 | Activity on the socket
06/04/2021 20:18:54.598 : Connection 572 | Received a packet.
06/04/2021 20:18:54.599 : Connection 572 | SecureChannel 8 | Verifying chunk signature
06/04/2021 20:18:54.600 : Connection 572 | SecureChannel 8 | Calculated padding size to be 7
06/04/2021 20:18:54.602 : Connection 572 | SecureChannel 8 | Process a CLO
06/04/2021 20:18:54.603 : Connection 572 | SecureChannel 8 | CloseSecureChannel
06/04/2021 20:18:54.682 : Termination "Segment Violation" caught. (Signal 11) 1
Description
I have an OPC server application which works flawlessly when running inside Visual Studio, but when running the release build sometimes when a session is closed the application crashes due to heap corruption. Using OpenSSL 1.1.1k and calling UA_Server_run_iterate(server, false) every 100ms from main application thread.
Background Information / Reproduction Steps
Happening randomly but regularly. Sessions are using Basic256Sha256, SignAndEncrypt with username/password authentication.
Trace log when working:
Trace log when not working:
Call stack when crash occurs:
Used CMake options:
UA_ENABLE_DA=1 UA_ENABLE_DISCOVERY=1 UA_ENABLE_ENCRYPTION=1 UA_ENABLE_ENCRYPTION_OPENSSL=1 UA_ENABLE_METHODCALLS=1 UA_ENABLE_NODEMANAGEMENT=1 UA_ENABLE_PARSING=1 UA_ENABLE_SUBSCRIPTIONS=1 UA_LOGLEVEL=100 UA_MULTITHREADING=0
Checklist
Please provide the following information:
UA_LOGLEVEL
set as low as necessary) attached