Page 1 of 1

dynamically added nodes disapears after reboot in UaExpert

Posted: 22 Mar 2021, 14:35
by SvenPC
Environment
Using C++ OPCUA SDK V1.7.4
OPCUA Server as Windows application
UaExpert as OPCUA Client

Task
Adding additional OPCUA nodes or namespace after starting the OPCUA server via UaServerApplication->start()

How to reproduce
- Starting OPCUA server an wait until all nodes are added
- Start UaExpert and connect to the OPCUA server
- Add OPCUA nodes or add a node manager after you have called UaServerApplication->start()
- use one of the added nodes in UaExpert in "Data Access View"
- Reboot the OPCUA server
- in the moment when UaServerApplication->start() is called the variable disapears in UaExpert
- in the UaExpert and Wireshark you can see BadNodeIdUnknown

Remarks
- Other OPCUA Clients shows the same behaviour.

Questions
- Is it really necessary to have all OPCUA nodes created before UaServerApplication->start() is called?
- Is there any way to avoid blocking the dynamically added OPCUA nodes by OPCUA clients?

Thanks
Sven

Re: dynamically added nodes disapears after reboot in UaExpert

Posted: 21 Jul 2021, 10:44
by Support Team
Hello SvenPC,

The monitoredItemCreateResults of the Node is BadNodeIdUnknown (The node id refers to a node that does not exist in the server address space.).

If a node does not exist in the server, any access (Read, CreateMonitoredItems) returns an error (BadNodeIdUnknown).

The UaExpert tries to re-create monitored items at reconnect (e.g. if you restarted the server) and removes the items from the Data Access View if the server returns an error that indicates that the node does not exist (BadNodeIdUnknown).

The problem seems to be that your server is still adding nodes after start-up and if UaExpert reconnects, sometimes the nodes do already exist and sometimes they do not exist. This can lead to the result.

If it takes some time to create all nodes during the start-up of the server, you should not allow client connections until all nodes are created.
The easiest option is to block NodeManager::afterStartUp until all initial nodes are created. This makes sure the server endpoints are not opened and clients are not able to connect.

If nodes are added/removed later and you cannot wait until all nodes are created, the seen behavior cannot be changed.
A client that is configured to use NodeIds would retry until it is stopped or it is not able to access the node.

In void MyServerCallback::afterNodeManagersStarted()
Please, check how long it takes to create all the initial nodes, then sleep for the same amount of time.