server shutdown notification

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Stefan_L_01
Sr. Member
Sr. Member
Posts: 18
Joined: 18 Nov 2016, 20:17

server shutdown notification

Post by Stefan_L_01 »

Hi again
When I shutdown my Server, the Client gets the shutdown notification very late, after some seconds (3,4seconds). Why is reacts so slow, why this huge delay?

When I set the wait param in server->stop() to 1, the Client does not get notification of shutdown at all! Of course this gives us some troubles. Why does Client get no notification?
Is it the MinKeepAliveInterval of Server configuration (5000 used currently, default) influencing the shutdown behaviour somehow?

Is there a mechanism like after last Client disconnected, don´t wait any longer, shutdown and return? So you could use 10sec wait time but you quit as fast as possible?

Edit: I have another question
My application can restart internally in a different configuration - MY configuration changes. The opcua Server is closed, shutdown, cleanup, everything gone. I restart (still in same exe) my processes and reopen the opcua Server again, in very much the same configuration - 100% equal, port, Server config, everything. However the adress space may look different in some subareas.
Now: When I Switch my configuration, ua expert can not connect to the new Server instance - the session per Client Limit (set to 1 ) Fails.
But: When I Switch back to the original configuration where uaexpert was connected too first time, ua expert successfully reconnects.
How can this be when the Server config for both configurations is very much the same? Where does the difference come from?
Thx for clarification

Regards
Stefan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3070
Joined: 18 Mar 2011, 15:09

Re: server shutdown notification

Post by Support Team »

Hello Stefan,

the information about the shutdown is not sent as an event. This is one reason why the client SDK does a cyclic read on the ServerStatus (this includes SecondsTillShutdown and ShutdownReason).
If you want to get the information faster you can set the watchdog read cycle to a shorter time e.g. 1 second.

see SessionConnectInfo::nWatchdogTime:
http://documentation.unified-automation ... tInfo.html

If no client is connected the server shutsdown without delay.
If at least 1 client is connected the server waits the secondsTillShutdown before shutting down (even if the last client disconnected already within that time).
Best regards
Unified Automation Support Team

Stefan_L_01
Sr. Member
Sr. Member
Posts: 18
Joined: 18 Nov 2016, 20:17

Re: server shutdown notification

Post by Stefan_L_01 »

ok thx
But how can I know as Server that I have to wait at least x seconds because the Clients have Setup a watchdog Intervall of x seconds ?
If I set my shutdown time less, there is a risk that Clients miss the shutdown, right?
Is there no automatic mode that the Server detects the watchdog Intervalls internally and safely shuts down in a period at least as Long?
BR
Stefan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3070
Joined: 18 Mar 2011, 15:09

Re: server shutdown notification

Post by Support Team »

Hello Stefan,
If I set my shutdown time less, there is a risk that Clients miss the shutdown, right?
There always is a risk to miss that. The clients need to be able to handle the situation gracefully.
In fact the client can't do much except getting the shutdown reason and cleanup all subscriptions and sessions.
So the information you'd actually miss in the client application is the ShutdownReason and if supported the EstimatedReturnTime. If it is important for you to not miss the shutdown you need to handle that on application level e.g. create a MonitoredItem for the ServerStatus variable. Note that this will just minimise the risk but not eliminate it.
Best regards
Unified Automation Support Team

Post Reply