WIP Skip non-hierarchical refs in topological sort#292
Open
andreasebner wants to merge 4 commits intomasterfrom
Open
WIP Skip non-hierarchical refs in topological sort#292andreasebner wants to merge 4 commits intomasterfrom
andreasebner wants to merge 4 commits intomasterfrom
Conversation
The topological sort in Nodeset_sort() determines the order in which nodes are added to the server. Previously, nodeRefsReady() treated ALL inverse references (except HasTypeDefinition) as ordering dependencies. This caused infinite-loop deadlocks when two nodes in the same nodeset referenced each other via a non-hierarchical reference type. Only inverse hierarchical references (subtypes of HierarchicalReferences i=33) create true parent-child ordering dependencies. Non-hierarchical references (e.g. HasCondition, HasSubStateMachine) are cross-references that do not require ordering. Instead of hardcoding known hierarchical reference type IDs, this fix introduces an isHierarchicalRef callback in NL_FileContext. The open62541 backend implements this callback by using UA_Server_browseRecursive to discover all subtypes of HierarchicalReferences from the server's reference type hierarchy at init time. This makes the check robust against future OPC UA spec additions and custom hierarchical reference types from any namespace.
3e375ab to
8e263a0
Compare
Some companion specs (IOLink, PNENC, PNRIO) declare ValueRank=1 but provide scalar default values in the XML. After XML decoding, if the resulting UA_Variant is scalar but the node's ValueRank requires an array, set arrayLength=1 to convert the scalar into a valid one-element array. This avoids BadTypeMismatch from the server's compatibleValueRankValue() check.
Emit a warning via the NodesetLoader logger when a scalar value is auto-wrapped into a one-element array. This makes the workaround visible so users can identify companion spec XML authoring bugs (missing ListOf* wrapper around the value element).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The topological sort in nodeRefsReady() previously blocked on ALL inverse non-HasTypeDefinition references. This caused deadlocks when two nodes in the same nodeset referenced each other via a non-hierarchical reference type.
Non-hierarchical references do not establish parent-child ordering dependencies. Only inverse hierarchical references (subtypes of HierarchicalReferences i=33) and forward HasTypeDefinition require ordering constraints.