Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): Problems with event subscription in reduced namespace #6298

Open
wants to merge 1 commit into
base: 1.4
Choose a base branch
from

Conversation

nogryy
Copy link
Contributor

@nogryy nogryy commented Feb 21, 2024

Hi,

we are currently trying to integrate version 1.4.0-rc2 (from 1.3.6). If we subscribe to the EventSource in the UAExpert (v1.7.1) now, the Tool returns an error "Item 0 failed with error BadTypeDefinitionInvalid." and cancel the event subscription.
This also happens in the example project (tutorial_server_events).
We use the REDUCED namespace, if we switch to the FULL namespace the event subscription works but this is not an option for us.

If we adjust the order of the clause validation in the ua_subscription_events_filter.c (like in 1.3.6) the event subscription works again.

…ere problems when using the reduced namespace.
@jpfr
Copy link
Member

jpfr commented Feb 21, 2024

With your change, if the BrowsePath is empty, then the TypeDefinitionId is not checked.
That doesn't sound right.
Is it possible that your EventFilter uses an EventType that does not exist in the reduced information model?
Then we can try to add just that EventType...

@nogryy
Copy link
Contributor Author

nogryy commented Feb 22, 2024

Hi @jpfr ,

thanks for the fast reply.

I guess we have exactly the same problem, described in this comment (1.3.6):

/*ToDo: Check the following workaround. In UaExpert Event View the selection
* of the Server Object set up 7 select filter entries by default. The last
* element ist from node 2782 (A&C ConditionType). Since the reduced
* information model dos not contain this type, the result has a brows path of
* "null" which results in an error. */

In 1.4.0 the TypeDefinitionId check is before the BrowsePath check, without the "Workaround" (see comment above):

UA_NodeId baseEventTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEEVENTTYPE);
if(!isNodeInTree_singleRef(server, &sao->typeDefinitionId,
&baseEventTypeId, UA_REFERENCETYPEINDEX_HASSUBTYPE))
return UA_STATUSCODE_BADTYPEDEFINITIONINVALID;
/* AttributeId is valid ? */
if(sao->attributeId == 0 || sao->attributeId >= 28)
return UA_STATUSCODE_BADATTRIBUTEIDINVALID;
/* If the BrowsePath is empty, the Node is the instance of the
* TypeDefinition. (Part 4, 7.4.4.5) */
if(sao->browsePathSize == 0)
return UA_STATUSCODE_GOOD;

In 1.3.6 the TypeDefinitionId check is after the BrowsePath check:

if(&eventFilter->selectClauses[i].browsePath[0] == NULL) {
result[i] = UA_STATUSCODE_BADBROWSENAMEINVALID;
continue;
}
/* eventType is a subtype of BaseEventType ? */
UA_NodeId baseEventTypeId = UA_NODEID_NUMERIC(0, UA_NS0ID_BASEEVENTTYPE);
if(!isNodeInTree_singleRef(
server, &eventFilter->selectClauses[i].typeDefinitionId,
&baseEventTypeId, UA_REFERENCETYPEINDEX_HASSUBTYPE)) {
result[i] = UA_STATUSCODE_BADTYPEDEFINITIONINVALID;
continue;
}

So, our solution was to return to the check order like in 1.3.6.

Perhaps we don't fully understand this function and also the OPC Spec is not easy to understand.

At the moment, our workaround (without a open62541 fix) is to add the missing NodeId (mentioned in the comment above) when the opc server starts up.

But I don't know if this NodeID fits into an Eventminimal nodeset...

Unfortunately, we cannot see what the best solution is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants