I'm writing an open62541-client (1.3.4) and I'm testing the inactivity-handling.
If I freeze the server app (ctrl+z) and resume it later, it won't recover properly.
If I understand the docs properly there's nothing my client code is supposed to do as long as the connectionstatus is UA_STATUSCODE_GOOD, since the stack has still hope to recover.
The server shows that the session can not be found / has timed out.
[2023-04-14 13:45:32.282 (UTC+0000)] info/server AccessControl: Anonymous login is enabled
[2023-04-14 13:45:32.282 (UTC+0000)] info/server AccessControl: x509 certificate user authentication is enabled
[2023-04-14 13:45:32.282 (UTC+0000)] warn/server Username/Password Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2023-04-14 13:45:32.282 (UTC+0000)] warn/userland AcceptAll Certificate Verification. Any remote certificate will be accepted.
[2023-04-14 13:45:32.282 (UTC+0000)] info/userland AccessControl enabled.
[2023-04-14 13:45:32.282 (UTC+0000)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2023-04-14 13:45:32.282 (UTC+0000)] info/server AccessControl: x509 certificate user authentication is enabled
[2023-04-14 13:45:32.282 (UTC+0000)] warn/server Username/Password Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2023-04-14 13:45:32.283 (UTC+0000)] info/network TCP network layer listening on opc.tcp://vocamdev.vocam:4840/
[2023-04-14 13:45:32.590 (UTC+0000)] info/network Connection 7 | New connection over TCP from 127.0.0.1
[2023-04-14 13:45:32.591 (UTC+0000)] info/channel Connection 7 | SecureChannel 1 | SecureChannel opened with SecurityPolicy
[2023-04-14 13:45:32.591 (UTC+0000)] info/session SecureChannel 1 | Session "" | Session created
[2023-04-14 13:45:32.592 (UTC+0000)] info/session SecureChannel 1 | Session "" | ActivateSession: Session activated
[2023-04-14 13:45:32.593 (UTC+0000)] info/session SecureChannel 1 | Session "" | Subscription 1 | Subscription created (Publishing interval 500.00ms, max 1000 notifications per publish)
[2023-04-14 13:45:32.593 (UTC+0000)] info/session SecureChannel 1 | Session "" | Subscription 1 | MonitoredItem 1 | Created the MonitoredItem (Sampling Interval: 250.00ms, Queue Size: 1)
[2023-04-14 13:45:42.193 (UTC+0000)] info/session SecureChannel 1 | Session "" | Session has timed out
[2023-04-14 13:45:42.193 (UTC+0000)] info/session SecureChannel 1 | Session "" | Subscription 1 | Subscription deleted
[2023-04-14 13:45:42.193 (UTC+0000)] info/server Subscription 1 | MonitoredItem 1 | Deleting the MonitoredItem
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | ReadRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:42.646 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | PublishRequest refused without a valid session
[2023-04-14 13:45:43.147 (UTC+0000)] warn/channel Connection 7 | SecureChannel 1 | CloseSession: No Session activated to the SecureChannel
[2023-04-14 13:45:43.147 (UTC+0000)] info/channel Connection 7 | SecureChannel 1 | CloseSecureChannel
[2023-04-14 13:45:44.148 (UTC+0000)] info/network Connection 7 | New connection over TCP from 127.0.0.1
[2023-04-14 13:45:45.651 (UTC+0000)] info/channel Connection 7 | SecureChannel 2 | SecureChannel opened with SecurityPolicy
[2023-04-14 13:45:46.653 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session created
[2023-04-14 13:45:47.653 (UTC+0000)] info/session SecureChannel 2 | Session "" | Client tries to use a session that has timed out
[2023-04-14 13:45:47.653 (UTC+0000)] warn/channel Connection 7 | SecureChannel 2 | ActivateSession: Session not found
[2023-04-14 13:45:48.154 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session created
[2023-04-14 13:45:49.155 (UTC+0000)] info/session SecureChannel 2 | Session "" | Client tries to use a session that has timed out
[2023-04-14 13:45:49.156 (UTC+0000)] warn/channel Connection 7 | SecureChannel 2 | ActivateSession: Session not found
[2023-04-14 13:45:49.657 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session created
[2023-04-14 13:45:50.658 (UTC+0000)] info/session SecureChannel 2 | Session "" | Client tries to use a session that has timed out
[2023-04-14 13:45:50.658 (UTC+0000)] warn/channel Connection 7 | SecureChannel 2 | ActivateSession: Session not found
[2023-04-14 13:45:51.159 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session created
[2023-04-14 13:45:52.160 (UTC+0000)] info/session SecureChannel 2 | Session "" | Client tries to use a session that has timed out
[2023-04-14 13:45:52.160 (UTC+0000)] warn/channel Connection 7 | SecureChannel 2 | ActivateSession: Session not found
[2023-04-14 13:45:52.193 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session has timed out
[2023-04-14 13:45:52.193 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session has timed out
[2023-04-14 13:45:52.193 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session has timed out
[2023-04-14 13:45:52.193 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session has timed out
[2023-04-14 13:45:52.660 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session created
[2023-04-14 13:46:02.193 (UTC+0000)] info/session SecureChannel 2 | Session "" | Session has timed out
The client detects that the session is invalid, but creating a new one isn't succesful
[2023-04-14 13:45:32.592] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:32.592] [info ] OPCUA 5 A session with the server is activated
[2023-04-14 13:45:32.593] [info ] OPCUA 5 Create subscription succeeded, id 1
[2023-04-14 13:45:32.594] [info ] OPCUA 5 Monitoring UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME', id 1
[2023-04-14 13:45:33.135] [info ] OPCUA 5 date is: 14-04-2023 13:45:32.845
[2023-04-14 13:45:33.636] [info ] OPCUA 5 date is: 14-04-2023 13:45:33.344
[2023-04-14 13:45:34.137] [info ] OPCUA 5 date is: 14-04-2023 13:45:33.844
[2023-04-14 13:45:34.637] [info ] OPCUA 5 date is: 14-04-2023 13:45:34.345
[2023-04-14 13:45:35.138] [info ] OPCUA 5 date is: 14-04-2023 13:45:34.844
[2023-04-14 13:45:35.639] [info ] OPCUA 5 date is: 14-04-2023 13:45:35.344
[2023-04-14 13:45:36.139] [info ] OPCUA 5 date is: 14-04-2023 13:45:35.845
[2023-04-14 13:45:36.640] [info ] OPCUA 5 date is: 14-04-2023 13:45:36.344
[2023-04-14 13:45:37.140] [info ] OPCUA 5 date is: 14-04-2023 13:45:36.845
[2023-04-14 13:45:40.142] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:40.142] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:40.142] [info ] OPCUA 5 date is: 14-04-2023 13:45:39.656
[2023-04-14 13:45:40.643] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:40.643] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:40.643] [info ] OPCUA 5 date is: 14-04-2023 13:45:40.157
[2023-04-14 13:45:41.143] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.143] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.143] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.143] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.143] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.143] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.143] [info ] OPCUA 5 date is: 14-04-2023 13:45:40.657
[2023-04-14 13:45:41.645] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.645] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.645] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.645] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.645] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:41.645] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:41.645] [info ] OPCUA 5 date is: 14-04-2023 13:45:41.157
[2023-04-14 13:45:42.145] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.145] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.145] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.145] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.145] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.145] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.145] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.145] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.145] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.145] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.146] [info ] OPCUA 5 date is: 14-04-2023 13:45:41.657
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionClosed
[2023-04-14 13:45:42.646] [info ] OPCUA 5 date is: 14-04-2023 13:45:42.157
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadNoSubscription
[2023-04-14 13:45:42.646] [warning] OPCUA 4 Received Publish Response with code BadNoSubscription
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadNoSubscription
[2023-04-14 13:45:42.646] [warning] OPCUA 4 Received Publish Response with code BadNoSubscription
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadNoSubscription
[2023-04-14 13:45:42.646] [warning] OPCUA 4 Received Publish Response with code BadNoSubscription
[2023-04-14 13:45:42.646] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:42.646] [info ] OPCUA 4 The ServiceResult has the StatusCode BadNoSubscription
[2023-04-14 13:45:42.646] [warning] OPCUA 4 Received Publish Response with code BadNoSubscription
[2023-04-14 13:45:43.146] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:43.146] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:43.146] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:43.146] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:43.147] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:43.147] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:43.147] [info ] OPCUA 5 Subscription Id 1 was deleted
[2023-04-14 13:45:43.147] [info ] OPCUA 4 Client Status: ChannelState: Closed, SessionState: Closed, ConnectStatus: Good
[2023-04-14 13:45:43.147] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:43.147] [info ] OPCUA 5 The client is disconnected
[2023-04-14 13:45:43.147] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:43.147] [warning] OPCUA 4 Received BadSessionIdInvalid
[2023-04-14 13:45:43.147] [warning] OPCUA 1 Connection 0 | SecureChannel 0 | Receiving the response failed with StatusCode BadInternalError
[2023-04-14 13:45:43.147] [warning] OPCUA 4 Received BadSessionIdInvalid
[2023-04-14 13:45:43.648] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:43.648] [info ] OPCUA 5 The client is disconnected
[2023-04-14 13:45:43.648] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:44.649] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:44.649] [info ] OPCUA 5 Waiting for ack
[2023-04-14 13:45:44.649] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:45.149] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:45.149] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:45.650] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:45.650] [info ] OPCUA 5 Waiting for OPN Response
[2023-04-14 13:45:45.650] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:46.151] [info ] OPCUA 1 Connection 26 | SecureChannel 2 | SecureChannel opened with SecurityPolicy
http://opcfoundation.org/UA/SecurityPolicy#None and a revised lifetime of 120.00s
[2023-04-14 13:45:46.151] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2023-04-14 13:45:46.151] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:46.151] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:46.151] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:46.652] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:46.652] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:47.153] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Created, ConnectStatus: Good
[2023-04-14 13:45:47.153] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:47.153] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:47.653] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:47.653] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:48.154] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:48.154] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:48.154] [error ] OPCUA 4 ActivateSession failed with error code BadSessionIdInvalid
[2023-04-14 13:45:48.154] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2023-04-14 13:45:48.154] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:48.154] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:48.154] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:48.154] [error ] OPCUA 4 Session cannot be activated. Create a new Session.
[2023-04-14 13:45:48.154] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:48.154] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:48.655] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Created, ConnectStatus: Good
[2023-04-14 13:45:48.655] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:48.655] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:49.155] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:49.155] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:49.656] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:49.656] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:49.656] [error ] OPCUA 4 ActivateSession failed with error code BadSessionIdInvalid
[2023-04-14 13:45:49.656] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2023-04-14 13:45:49.656] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:49.656] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:49.656] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:49.656] [error ] OPCUA 4 Session cannot be activated. Create a new Session.
[2023-04-14 13:45:49.656] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:49.656] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:50.157] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Created, ConnectStatus: Good
[2023-04-14 13:45:50.157] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:50.157] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:50.658] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:50.658] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:51.158] [info ] OPCUA 4 Received a ServiceFault response
[2023-04-14 13:45:51.158] [info ] OPCUA 4 The ServiceResult has the StatusCode BadSessionIdInvalid
[2023-04-14 13:45:51.158] [error ] OPCUA 4 ActivateSession failed with error code BadSessionIdInvalid
[2023-04-14 13:45:51.158] [info ] OPCUA 4 Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good
[2023-04-14 13:45:51.158] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:51.158] [info ] OPCUA 5 A SecureChannel to the server is open
[2023-04-14 13:45:51.158] [info ] OPCUA 5 Session disconnected
[2023-04-14 13:45:51.158] [error ] OPCUA 4 Session cannot be activated. Create a new Session.
[2023-04-14 13:45:51.158] [trace ] void stateCallback(UA_Client*, UA_SecureChannelState, UA_SessionState, UA_StatusCode)
[2023-04-14 13:45:51.158] [info ] OPCUA 5 A SecureChannel to the server is open
Is that related to this change, perhaps?
https://github.com/open62541/open62541/commit/b70378d5fde34328623cc25381ae8ff1219a6bbf