Client can't reconnect to session

Skip to first unread message

Stamatis Poulios

Jun 25, 2021, 5:57:50 AM6/25/21
to open62541
Hi all.

I will try to explain the situation I am facing, hoping someone will give me a hint.

I have a client (open62541) which connects to a server (Unified Automation), using "UA_Client_connectUsername()" function.

Periodically, the client reads values from some nodes and does some further processing. In general, everything works as expected, but if set the execution period to 1 second, after some iterations, I get BadSecurityChecksFailed and the secure channel closes while the session goes from Activated to Created.

I modified my program, so when secure channel closes, it tries to reconnect using the same "UA_Client_connectUsername()" function., which should connect if not connected, or report that it is already connected otherwise.

The problem is that it doesn't reconnect. I get a warning that the client is already connected, though the status is secureChannel:Closed and session:Created.

My basic question is, how does open62541 handle sessions and connections? It is not clear in the documentation.
In addition, how can my client reconnect to an already open session creating a new channel? Isn't that handled by "UA_Client_connectUsername()" function?

Any hint to the right direction, will be highly appreciated.

Thank you in advance!

Daniel Gonçalves

Jun 30, 2022, 10:49:47 AMJun 30
to open62541
Did you figure it out? I'm having the same issue.

Stamatis Poulios

Jul 4, 2022, 4:40:54 AMJul 4
to Daniel Gonçalves, open62541
Dear Daniel,

I can't tell you for sure, since it's been a year since this post. By inspecting my code, I see that I have changed the connection logic based on the example

I am not sure, but perhaps the sleep (on line 52 of the code on the link), does the trick.

Hope that helps,

You received this message because you are subscribed to a topic in the Google Groups "open62541" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit

Julius Pfrommer

Jul 12, 2022, 4:25:27 AMJul 12
to open62541
Hey there,

We just pushed a huge update to the client on master.
Automatic reconnect is also covered in the unit tests.

I suppose you are on v1.3 or master from a few weeks ago.

Can you try with the current master?
Let's then open an issue to fix for master and / or 1.3.

Regards, Julius
Reply all
Reply to author
0 new messages