I am developing an OPC UA Server using your .NET Server SDK and ran into a rare problem with not being able to detect a disconnect from an OPC UA client while the client's login credentials are being checked.
When a client connects to our server, we use the SessionManager_ImpersonateUser event to check the username and password with a remote database. Most of the time this works fine but occasionally, the client times out before we get back the database results. In those cases, the SessionManager_SessionClosing event is not invoked and the SessionManager.GetSessions() shows that the client's session is still present. It appears that this session never times out so the non-connected client is never disconnected from the server.
From testing, I noticed that the sequence of events is SessionManager_SessionCreated -> SessionManager_ImpersonateUser -> SessionManager_SessionActivated. When the situation above occurs, SessionManager_SessionActivated is never invoked.
Is there a way to detect that a client disconnected before SessionManager_SessionActivated is invoked?
Based on documentation,
Is this also true if the client's session has not been activated?If a Client disappears, the Session and all resources allocated will be freed by the SessionManager after a timeout period expires.
http://documentation.unified-automation ... ManagerEtc
Sincerely,
Jonathan