Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
After OpcUaServer restart not all namespaces are available
February 27, 2025
12:03, EET
Avatar
rocket science
Member
Members
Forum Posts: 90
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Hi all,

we had an issue when an OpcUaServer (currently don’t remember the manufacturer) was restarted.

The Client SDK was connected to the OpcUaServer, then the OpcUaServer was restarted.
So Client SDK lost connection and tried to reconnect.
When the Client SDK got connection, we could see following logging:

com.prosysopc.ua.client.UaClient@5745c530|WARN |refreshNamespaceTable,
the old NamespaceArray: [
http://opcfoundation.org/UA/,
Namespace1,
Namespace2,
Namespace3,
Namespace4
]
is not a subset of new NamespaceArray: [
http://opcfoundation.org/UA/,
Namespace1,
Namespace2
]
, older NamespaceIndexes are obsolete

com.prosysopc.ua.client.UaClient@5745f230|INFO |reconnect: Reconnected to server (new session)

So it seems that after reconnect, the Namespace3 and Namespace4 where not (yet) in the servers namespace table.

This led to the situation that when we tried to get the namespace index for Namespace3 we could not find the Namespace3 in the namespace table (as after reconnect it was not available).

Is this a normal OpcUa-Server behaviour that after restart not all namespaces are available (and the server allows a connection already) – or should it be like this that the server should allow a connection only when all the namespace are already setup correctly?

February 27, 2025
12:49, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1040
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

I would say if the server restarts so that the namespaces eventually are the same it is a design error, it should only allow connections after the namespaces are loaded.
In our SDK’s server side, you would need to only call UaServer.start after all NodeManagers are added. UaServer.init can be used to load the core namespace, so typically after that (or override the init method in the NodeManager). But if they are added after .start, then it is a race condition.

The spec says currently https://reference.opcfoundation.org/Core/Part5/v105/docs/6.3.1 “…
NamespaceArray defines an array of namespace URIs. This Variable is also referred as namespace table. The indexes into the namespace table are referred to as NamespaceIndexes. NamespaceIndexes are used in NodeIds in OPC UA Services, rather than the longer namespace URI. Index 0 is reserved for the OPC UA namespace, and index 1 is reserved for the local Server. Clients may read the entire namespace table or they may read individual entries in the namespace table. The Server shall not modify or delete entries of the namespace table while any client has an open session to the Server, because clients may cache the namespace table. A Server may add entries to the namespace table even if clients are connected to the Server. It is recommended that Servers not change the indexes of the namespace table but only add entries, because the client may cache NodeIds using the indexes. Nevertheless, it might not always be possible for Servers to avoid changing indexes in the namespace table. Clients that cache NamespaceIndexes of NodeIds should always check when starting a session to verify that the cached NamespaceIndexes have not changed.
…”

If you observe an index that is unknown, you could use UaClient.getNamespaceTable(true) to force re-reading it from the server. SDK currently does that automatically when it reconnects or if it has failed monitoreditems and recreating them is enabled (in it is at least in the latest version). The latter helps in this exact case if you create the MonitoredItems with uri-form ExpandedNodeIds, then their creation would fail (since no uri->index conversion possible) until there is an entry in the table. If it detects there other changes than just additions to the table it will log the warn because any previous index you have obtained previously can be invalid.

February 27, 2025
14:52, EET
Avatar
rocket science
Member
Members
Forum Posts: 90
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thank you for your thoughts!

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 90

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 788

Moderators: 8

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1542

Posts: 6505

Newest Members:

Olpsom, shastaappleton, hildred39i, Adam, tammara49z, vktwaylon2, pilarstorkey83, Dwightsache, MollyAlori, somnath.kalane

Moderators: Jouni Aro: 1029, Pyry: 1, Petri: 0, Bjarne Boström: 1040, Jimmy Ni: 26, Matti Siponen: 353, Lusetti: 0, Elias: 0

Administrators: admin: 1