Open paddor opened 7 months ago
Weirdly enough, if I read the data type of an imported variable (that should have dataType=AlarmStatesStates
) using UA_Server_readDataType()
and UA_findDataType()
, I sometimes get no data type or the wrong data type. It's non-deterministic.
I was hoping to use UA_DataType.typeKind
to support these custom types but like this I have no path forward. Any ideas?
@matkonnerth Here's a working example in C along with the full XML nodeset. It tries to get the data type of g=16001624-6a1d-42d5-81d1-f54af84f5325
, which fails.
#include <open62541/plugin/log_stdout.h>
#include <open62541/server.h>
#include <open62541/server_config_default.h>
#include <open62541/plugin/nodesetloader.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
UA_Boolean running = true;
static void stopHandler(int sign) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "received ctrl-c");
running = false;
}
static void
testCallback(UA_Server *server, void *data) {
UA_StatusCode rc;
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "testcallback");
size_t index;
rc = UA_Server_getNamespaceByName(server, UA_STRING("http://foobar.example.com/Instances"), &index);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not determine namespace index for namespace URI");
abort();
}
UA_Guid guid;
UA_Guid_parse(&guid, UA_STRING("16001624-6a1d-42d5-81d1-f54af84f5325"));
UA_NodeId nodeId = UA_NODEID_GUID(index, guid);
UA_NodeId typeNodeId;
rc = UA_Server_readDataType(server, nodeId, &typeNodeId);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not read data type node id");
abort();
}
UA_String typeNodeIdString;
UA_String_init(&typeNodeIdString);
UA_NodeId_print(&typeNodeId, &typeNodeIdString);
UA_DataType *nodeDataType = UA_findDataType(&typeNodeId);
/* const UA_DataTypeArray *customTypes = UA_Server_getConfig(server)->customDataTypes; */
/* UA_DataType *nodeDataType = UA_findDataTypeWithCustom(&typeNodeId, customTypes); */
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "found data type node ID: %.*s", typeNodeIdString.length, typeNodeIdString.data);
UA_NodeClass outNodeClass;
rc = UA_Server_readNodeClass(server, typeNodeId, &outNodeClass);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not read node class of data type node");
abort();
}
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "data type node class: %i (is UA_NODECLASS_DATATYPE=%s)", outNodeClass, outNodeClass == UA_NODECLASS_DATATYPE ? "True" : "False");
if (nodeDataType) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "found data type: %s, typeKind=%i", nodeDataType->typeName, nodeDataType->typeKind);
}
else {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not look up data type");
/* abort(); */
return;
}
}
int main(int argc, const char *argv[]) {
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
UA_Server *server = UA_Server_new();
UA_ServerConfig_setDefault(UA_Server_getConfig(server));
UA_Server_run_startup(server);
/* Add a repeated callback to the server */
UA_Server_addRepeatedCallback(server, testCallback, NULL, 2000, NULL); /* call every 2 sec */
for (int cnt = 1; cnt < argc; cnt++) {
if (UA_StatusCode_isGood(UA_Server_loadNodeset(server, argv[cnt], NULL))) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "Nodeset %s loaded.", argv[cnt]);
}
else {
printf("Nodeset %s could not be loaded, exit\n", argv[cnt]);
return EXIT_FAILURE;
}
}
UA_Boolean waitInternal = true;
while(running) {
UA_Server_run_iterate(server, waitInternal);
}
/* UA_StatusCode retval = UA_Server_run(server, &running); */
UA_Server_run_shutdown(server);
UA_Server_delete(server);
return EXIT_SUCCESS;
}
Compile with:
gcc -std=c99 server.c -lopen62541 -o server
Run with:
./server nodeset.xml
Local output:
[2024-03-19 13:09:16.577 (UTC+0100)] info/eventloop Starting the EventLoop
[2024-03-19 13:09:16.578 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 13:09:16.578 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 13:09:16.578 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 13:09:16.674 (UTC+0100)] warn/userland ServerUrls already set. Overriding.
[2024-03-19 13:09:16.674 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 13:09:16.674 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 13:09:16.674 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 13:09:16.674 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 13:09:16.674 (UTC+0100)] warn/server Maximum SecureChannels count not enough for the maximum Sessions count
[2024-03-19 13:09:16.674 (UTC+0100)] info/network TCP | Listening on all interfaces
[2024-03-19 13:09:16.675 (UTC+0100)] info/network TCP 4 | Creating server socket for "0.0.0.0" on port 4840
[2024-03-19 13:09:16.677 (UTC+0100)] warn/network TCP 4294967295 | Error opening the listen socket for "::" on port 4840 (Address family not supported by protocol)
[2024-03-19 13:09:16.764 (UTC+0100)] info/userland Nodeset nodeset.xml loaded.
[2024-03-19 13:09:18.677 (UTC+0100)] info/userland testcallback
[2024-03-19 13:09:18.677 (UTC+0100)] info/server found data type node ID: ns=2;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4
[2024-03-19 13:09:18.677 (UTC+0100)] info/server data type node class: 64 (is UA_NODECLASS_DATATYPE=True)
[2024-03-19 13:09:18.677 (UTC+0100)] error/server could not look up data type
Open62541 configured and installed with:
pwd #=> /path/to/open62541
mkdir build && cd build
cmake .. -DUA_NAMESPACE_ZERO=FULL -DUA_ENABLE_NODESETLOADER=ON -DUA_ENABLE_TYPEDESCRIPTION=ON -DUA_MULTITHREADING=100 -DUA_ENABLE_PARSING=ON -DUA_ENABLE_DIAGNOSTICS=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug -DUA_DEBUG=1 -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DCMAKE_C_FLAGS_DEBUG='-fPIC -O0 -g'
make
sudo make install
The XML nodeset (gzipped): nodeset.xml.gz
@paddor : thank you for the detailled issue report, do you the result with the nodesetcompiler?
@matkonnerth Sorry, I didn't understand the question. The nodeset itself works, in another UA stack and also in this UA stack, at least when checked via UaExpert. What doesn't work is getting the real data type of the variable node.
sry, the open62541 has also the ability to generate c code for the information model (done with the nodesetcompiler). Would be interesting if the issue preserves with that method.
Here's the output:
$ python3 ./nodeset_compiler.py --types-array=UA_TYPES --existing ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml --xml /home/roadster/dev/roadster-projects/internal/roadster-protocol-simulator/conf/nodeset.xml myNS
INFO:__main__:Preprocessing (existing) ../../deps/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
INFO:__main__:Preprocessing /home/roadster/dev/roadster-projects/internal/roadster-protocol-simulator/conf/nodeset.xml
INFO:__main__:Generating Code for Backend: open62541
Traceback (most recent call last):
File "/home/roadster/dev/oss/open62541-ruby/ext/open62541/deps/open62541/tools/nodeset_compiler/./nodeset_compiler.py", line 227, in <module>
generateOpen62541Code(ns, args.outputFile, args.internal_headers, args.typesArray)
File "/home/roadster/dev/oss/open62541-ruby/ext/open62541/deps/open62541/tools/nodeset_compiler/backend_open62541.py", line 231, in generateOpen62541Code
code = generateNodeCode_begin(node, nodeset, code_global)
File "/home/roadster/dev/oss/open62541-ruby/ext/open62541/deps/open62541/tools/nodeset_compiler/backend_open62541_nodes.py", line 532, in generateNodeCode_begin
code.append(generateNodeIdCode(node.id) + ",")
File "/home/roadster/dev/oss/open62541-ruby/ext/open62541/deps/open62541/tools/nodeset_compiler/backend_open62541_datatypes.py", line 102, in generateNodeIdCode
raise Exception(str(value) + " no NodeID generation for bytestring and guid..")
Exception: ns=2;g=fc658c51-781b-4c13-8d4f-8c45f4054389 no NodeID generation for bytestring and guid..
What does this mean?
oh, seems that NodeIds with type ByteString or Guid are not supported by the nodesetcompiler
I've added support for GUID node IDs in a PR: https://github.com/open62541/open62541/pull/6355
The script completes successfully and gives me two files.
Generated header file:
/* WARNING: This is a generated file.
* Any manual changes will be overwritten. */
#ifndef MYNS_H_
#define MYNS_H_
#ifdef UA_ENABLE_AMALGAMATION
# include "open62541.h"
#else
# include <open62541/server.h>
#endif
_UA_BEGIN_DECLS
extern UA_StatusCode myNS(UA_Server *server);
_UA_END_DECLS
#endif /* MYNS_H_ */
Generated C file is attached as myNS.c.gz. Using the two new files in this program:
#include <open62541/plugin/log_stdout.h>
#include <open62541/server.h>
#include <open62541/server_config_default.h>
#include <open62541/plugin/nodesetloader.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include "myNS.h"
UA_Boolean running = true;
static void stopHandler(int sign) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "received ctrl-c");
running = false;
}
static void
testCallback(UA_Server *server, void *data) {
UA_StatusCode rc;
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "testcallback");
size_t index;
rc = UA_Server_getNamespaceByName(server, UA_STRING("http://foobar.example.com/Instances"), &index);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not determine namespace index for namespace URI");
abort();
}
UA_Guid guid;
UA_Guid_init(&guid);
UA_Guid_parse(&guid, UA_STRING("16001624-6a1d-42d5-81d1-f54af84f5325"));
UA_NodeId nodeId = UA_NODEID_GUID(index, guid);
UA_NodeId typeNodeId;
UA_NodeId_init(&typeNodeId);
rc = UA_Server_readDataType(server, nodeId, &typeNodeId);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not read data type node id");
abort();
}
UA_NodeClass outNodeClass;
UA_NodeClass_init(&outNodeClass);
rc = UA_Server_readNodeClass(server, typeNodeId, &outNodeClass);
if (rc != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not read node class of data type node");
abort();
}
UA_String typeNodeIdString;
UA_String_init(&typeNodeIdString);
UA_NodeId_print(&typeNodeId, &typeNodeIdString);
UA_DataType *nodeDataType = UA_findDataType(&typeNodeId);
/* const UA_DataTypeArray *customTypes = UA_Server_getConfig(server)->customDataTypes; */
/* UA_DataType *nodeDataType = UA_findDataTypeWithCustom(&typeNodeId, customTypes); */
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "found data type node ID: %.*s", typeNodeIdString.length, typeNodeIdString.data);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "data type node class: %i (is UA_NODECLASS_DATATYPE=%s)", outNodeClass, outNodeClass == UA_NODECLASS_DATATYPE ? "True" : "False");
if (nodeDataType) {
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "found data type: %s, typeKind=%i", nodeDataType->typeName, nodeDataType->typeKind);
}
else {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "could not look up data type");
/* abort(); */
return;
}
}
int main(int argc, const char *argv[]) {
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
UA_Server *server = UA_Server_new();
UA_ServerConfig_setDefault(UA_Server_getConfig(server));
UA_Server_run_startup(server);
/* Add a repeated callback to the server */
UA_Server_addRepeatedCallback(server, testCallback, NULL, 2000, NULL); /* call every 2 sec */
UA_StatusCode retval = myNS(server);
/* Create nodes from nodeset */
if(retval != UA_STATUSCODE_GOOD) {
UA_LOG_ERROR(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "Could not add the example nodeset. "
"Check previous output for any error.");
abort();
}
/* for (int cnt = 1; cnt < argc; cnt++) { */
/* if (UA_StatusCode_isGood(UA_Server_loadNodeset(server, argv[cnt], NULL))) { */
/* UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_USERLAND, "Nodeset %s loaded.", argv[cnt]); */
/* } */
/* else { */
/* printf("Nodeset %s could not be loaded, exit\n", argv[cnt]); */
/* return EXIT_FAILURE; */
/* } */
/* } */
UA_Boolean waitInternal = true;
while(running) {
UA_Server_run_iterate(server, waitInternal);
}
/* UA_StatusCode retval = UA_Server_run(server, &running); */
UA_Server_run_shutdown(server);
UA_Server_delete(server);
return EXIT_SUCCESS;
}
Compiled with:
gcc -std=c99 myNS.c serverWithmyNS.c -lopen62541 -o serverWithmyNS
Output:
$ ./serverWithmyNS
[2024-03-19 17:16:23.880 (UTC+0100)] info/eventloop Starting the EventLoop
[2024-03-19 17:16:23.880 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 17:16:23.880 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 17:16:23.880 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 17:16:23.981 (UTC+0100)] warn/userland ServerUrls already set. Overriding.
[2024-03-19 17:16:23.981 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 17:16:23.981 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 17:16:23.981 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 17:16:23.981 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 17:16:23.981 (UTC+0100)] warn/server Maximum SecureChannels count not enough for the maximum Sessions count
[2024-03-19 17:16:23.981 (UTC+0100)] info/network TCP | Listening on all interfaces
[2024-03-19 17:16:23.983 (UTC+0100)] info/network TCP 4 | Creating server socket for "0.0.0.0" on port 4840
[2024-03-19 17:16:23.985 (UTC+0100)] warn/network TCP 4294967295 | Error opening the listen socket for "::" on port 4840 (Address family not supported by protocol)
[2024-03-19 17:16:23.987 (UTC+0100)] info/session TCP 0 | SC 0 | Session "Administrator" | AddNode: Node could not add the new node to the nodestore with error code BadNodeIdExists
[2024-03-19 17:16:23.987 (UTC+0100)] error/server Could not add the example nodeset. Check previous output for any error.
fish: Job 2, './serverWithmyNS' terminated by signal SIGABRT (Abort)
It seems the compiled nodeset tries to create the same node twice?
@matkonnerth I've added logging to the generated code so I can see which node ID causes trouble.
[2024-03-19 18:10:38.829 (UTC+0100)] info/eventloop Starting the EventLoop
[2024-03-19 18:10:38.829 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 18:10:38.829 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 18:10:38.829 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 18:10:38.927 (UTC+0100)] warn/userland ServerUrls already set. Overriding.
[2024-03-19 18:10:38.927 (UTC+0100)] warn/server AccessControl: Unconfigured AccessControl. Users have all permissions.
[2024-03-19 18:10:38.927 (UTC+0100)] info/server AccessControl: Anonymous login is enabled
[2024-03-19 18:10:38.927 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 18:10:38.927 (UTC+0100)] warn/server x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-03-19 18:10:38.927 (UTC+0100)] warn/server Maximum SecureChannels count not enough for the maximum Sessions count
[2024-03-19 18:10:38.927 (UTC+0100)] trace/session TCP 0 | SC 0 | Session "Administrator" | Write attribute 13 of Node i=2254
[2024-03-19 18:10:38.927 (UTC+0100)] trace/session TCP 0 | SC 0 | Session "Administrator" | Write attribute 13 of Node i=2257
[2024-03-19 18:10:38.927 (UTC+0100)] info/network TCP | Listening on all interfaces
[2024-03-19 18:10:38.929 (UTC+0100)] info/network TCP 4 | Creating server socket for "0.0.0.0" on port 4840
[2024-03-19 18:10:38.931 (UTC+0100)] warn/network TCP 4294967295 | Error opening the listen socket for "::" on port 4840 (Address family not supported by protocol)
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=f9df004f-da1a-5d1c-976e-ea4135ffc8a7
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=f9afc88c-c431-5dfc-9122-060476e433d8
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=2226ed75-a294-5888-820f-d04ca325cdfc
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=f7a88a1a-2a3e-5148-94bb-2bd6bdd5f0e0
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=68734b65-41e6-5bfc-89d8-2d07b0a25129
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=e2535265-b87b-5a9b-8ab1-3f639dd44f60
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=d7e89415-4944-5c3c-b9fb-5390ad9728fa
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=444bf352-8ff2-501e-a684-72768b961da5
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=e01120e0-f442-5524-8aa2-b84940e75f92
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=2a9764a5-2f14-5453-9c26-95e939c43957
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=d6c9f0f0-b61a-56c7-a8a0-48093bbbbe3b
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=fe0ea47c-eb37-5bf1-9427-df9a853374ee
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=ad28882d-21cb-503e-a960-d278b8dfe822
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=f7b7bab9-7554-5620-b20c-b6d71f3ad378
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=2d910abe-b73e-5f29-a8e5-50f8d34e7e16
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=ba574a1b-5202-504f-8de3-46b6b5101170
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=44215d48-b38c-580a-9791-42c07f5b596d
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=7f4a9352-0ca8-5768-86d1-e628f7a83c9b
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=d8e2a7e5-f76c-5bc1-a9e4-af7f0d48ff93
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=cc8d9c94-4804-5997-9ee2-dd57c6d5d4ff
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=baed81e7-bc19-5a22-97c5-78f03d166c49
[2024-03-19 18:10:38.931 (UTC+0100)] info/userland adding node: ns=1;s=f7d25876-5dc8-5349-ac0a-469bd8d62528
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=01090c8f-ea39-5fb4-816c-3561fa2f4a51
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=59cf69e1-ee56-5e8c-829c-5234c9719536
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=7845c676-a0fe-57f4-ab82-7bc4bcbb86da
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=13fe661c-9ace-5b82-b506-44308f5c1b10
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=84286e72-4b8d-50e3-bd44-c38c68ffc71d
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=17842011-afc6-50ad-bded-0ec28f211116
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=131cddbf-7692-5049-a2d9-a3253028330e
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=757dc22c-bc04-5746-8344-1bc90b4e7126
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=31ba064f-12b8-56f4-8ce2-0704e9edc9b7
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=93331a32-82e7-5662-a17a-f1bcbc52297d
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8cda075b-df3a-5d63-a1d1-0d1de06a709e
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=e31b28b5-07ff-5ccd-b712-038ca8dae719
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8b7d8e98-9a90-5cf9-9559-74a34d920505
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=7e88cc4b-0671-5d3d-865a-34a66c97ee9f
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=48c3f8ef-cad1-508c-b62b-771c069d7c38
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=c0a1a081-3ddb-584f-a58c-2aa094c7101f
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=93edd896-36ca-5974-a31f-8aa78df8a2d3
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=f8fb86aa-9b9c-50d9-9c81-c45b89fe73ab
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=61cdd974-53d3-5058-9dd3-ff040a2a8bc9
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=56f11b18-7e5d-5f6e-a01d-1138f3c5d0a0
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=0dd40a9f-d994-5055-948f-96b561495c5c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=57915cd6-8302-596d-8ba1-9203db2b24fb
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=441cf26a-b1a9-5633-94d0-21e6904a5050
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=9c9026c7-7eb6-5fd0-a682-3bd3e769559c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=ffec78bd-afe3-5a47-9457-42d7d14f3cac
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=81ca935f-b5fe-52b0-8008-abff52118c1e
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8e315445-c485-5c5b-95ef-00efcfd967f8
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=0f57eb13-3665-564d-877f-c113fab9f2e8
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=fb372294-e9ff-52c9-b898-de8bb4337f64
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8db88661-9c77-5968-83ba-9c4b3b555f72
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=9ff4e054-b991-5bd0-adc8-e3ebdee9805e
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=0a85a842-af3f-5f1f-8e3d-63e72123a03a
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=181f0e9b-af19-5c38-a1dc-c782c615433c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=910d3fae-bc7c-5de2-bf11-e2350b3f631b
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=91169da5-8e6c-5205-b8fe-e392772f50a9
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=d05be581-9193-55ad-9db1-3c172cb1fef5
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=6b9a4c75-229a-59ed-8926-bdc112854ec3
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=84943880-7621-5bca-8d38-da0817dd3303
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=92876fde-0fc3-567b-8481-f090fa64e872
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=364f848d-d610-53bc-b57d-5b4110ab21df
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=97fe5a5e-ed21-5572-87e8-6268fa9fc22d
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=b7bae6f3-4a74-5294-bd76-7a408da89050
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=37eade80-826c-5114-a51d-de391463287c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=4b45b9b5-970d-5781-80b4-ecf83a9a2005
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=9ce4fba4-93e4-5ddd-87e9-0890ac708f50
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=bd86e95b-5569-5771-8378-33e9d369dec6
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=fefaf5f9-56b4-5eea-af01-b4d2e6c93c3f
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=1f7e639f-1d1b-547b-befa-9fd8b1d3882f
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=f0303c12-3b5a-5860-980c-6258e6c0d34d
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=79ad996b-ded3-58be-bfc6-f03cdcccfa31
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=e0045ef1-9cb1-58a3-a8af-b5bcae64ec2c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=0f6002dd-57bc-5551-bdb6-356d4a8500fa
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=ef3b4661-63bc-524b-b39d-4f9125193d77
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8b81624b-c15f-5fba-abb8-5d9ddbed7d80
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=0d39e10c-2af9-55a4-9c58-6206a9ab3c8f
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=6eeb9df7-1710-5607-94d8-416d3768d81c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=96487913-7078-52b0-b25e-127ef001c441
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=b2559ef2-ffbb-54f0-968c-6a9200c8619e
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=8c7e2037-bead-545d-9439-073d3f41ca50
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=811c8d52-bfb8-54db-b50d-f2d2c56787eb
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=1;s=91428b80-ccb1-5adb-8685-5d51c867a0d3
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=2;g=fc658c51-781b-4c13-8d4f-8c45f4054389
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=2;g=af047b04-2504-5ba2-a028-749f642ceb5c
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=2;g=c5929a1a-9be7-5787-b233-b203c4e513b0
[2024-03-19 18:10:38.932 (UTC+0100)] info/userland adding node: ns=2;g=d3938275-cbed-5327-8675-56ddf56a3997
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=a740ab5d-62c5-582c-a0fa-b142fdb86bf7
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=97d5b32e-ffb0-5299-a08c-2696fea8b43c
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=ff7b5021-3d76-5a42-9f65-e095ac9cca5e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=b05adb05-12df-4eda-9a65-ac4600f8313e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=fdf66ccb-8190-5c5d-87a1-1d779061f01b
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=e64e0301-2dda-44a0-955c-ac4600f8313e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=09e0edf4-851a-50e7-a42b-043fd4573fe5
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=b4a75a36-9d18-4e51-ab3f-ac4600f8313e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=642ed070-5c78-560f-ad5c-8dfe58e17023
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=fda6f8f8-5038-5940-969c-d6f3436f9fb1
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=97bd1fec-a753-4120-bd31-ac4f011cb812
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=5a47e1d3-672a-5320-b845-dcd34030a3e8
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=7c2bd09a-f2bd-4249-b6c1-ac4f011ceb0c
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=4d873b27-f9c6-5eaa-b9ec-77e117bfee2e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=3e02a603-c179-4c83-9ed4-ac4f011c7cac
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=317b9aee-9022-4a80-a96c-ac4f011c4dc2
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=fcb05c4b-2a97-5ba1-abe0-8e3852fa5f73
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=ef3f83c3-78ba-5ea4-8805-edfd0cf27913
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=fd14ce13-7b70-4005-8762-ac4600f8314c
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=36d02bbd-0e02-5908-bc0c-74c71825c18a
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=bee76ec8-0786-46d1-b373-ac4600f8314c
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=e259fb1c-2a77-5488-8b5c-ef0f4662534f
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=ed5acd34-3330-50a6-9264-2843b3fef93a
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=b3f6f30f-0a2d-4f64-a831-ac4600f8313e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=23cbae22-c6e7-4c3e-bef2-ac4600f8313e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=372bb81b-5a71-5af8-b2c1-650ebc8b5d0e
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=1;s=ec18c187-e802-5c72-8525-bbac2c6f3117
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=f65804d8-b12e-4960-b229-b0ec00b18ae0
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=f1f3d63c-21ec-42ed-a342-b0ec01099d0f
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=eb72f857-d893-40c5-919e-b0ed008ef8da
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=ea648f16-f682-4a39-9696-b0ee00fe895c
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=e9c4c83a-e143-4cc2-8d07-b0ec01098e74
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=e881a275-eb-45c7-842d-b0ec010a5c05
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=e29704e5-c2b9-4401-8bb7-b0ed008ef007
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=df71f9c2-f939-4c6d-9e7f-b0ee01122ff1
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=df112ac1-db61-4f9a-a415-b0ec010a56bc
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=de320329-ef83-4aab-82fb-b0ed008f00f4
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=d95af173-f725-4259-b324-b0ec00b1fa1d
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=d6a83483-d63b-40fd-83d7-b0ed015bbc90
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=d3750633-929f-4ce8-9313-b0ed008fa287
[2024-03-19 18:10:38.933 (UTC+0100)] info/userland adding node: ns=2;g=c99a4933-9ba-456e-89c4-b0ee01003c89
[2024-03-19 18:10:38.933 (UTC+0100)] info/session TCP 0 | SC 0 | Session "Administrator" | AddNode: Node could not add the new node to the nodestore with error code BadNodeIdExists
[2024-03-19 18:10:38.933 (UTC+0100)] error/server Could not add the example nodeset. Check previous output for any error.
fish: Process 270262, './serverWithmyNS' from job 2, './serverWithmyNS | sed -r "s/\x…' terminated by signal SIGABRT (Abort)
It is always the same: ns=2;g=c99a4933-9ba-456e-89c4-b0ee01003c89
I'm not sure if it has to do with the missing leading zeroes in the GUID.
I've fixed the issue with missing leading zeroes. See https://github.com/open62541/open62541/pull/6355.
The server with the compiled nodeset now imports many more variables before aborting:
...
[2024-03-22 13:07:22.748 (UTC+0100)] info/userland adding node: ns=1;s=0227d833-2a48-4578-9c95-ac4600f8314c
[2024-03-22 13:07:22.748 (UTC+0100)] info/userland adding node: ns=1;s=0168852c-858e-4407-8dbd-ac4600f8313e
[2024-03-22 13:07:22.748 (UTC+0100)] info/userland adding node: ns=1;s=015ef1e0-d393-4631-8a52-ac4600f8313e
[2024-03-22 13:07:22.748 (UTC+0100)] info/userland adding node: ns=1;s=0152d396-e7c5-4086-908e-ac4600f83139
[2024-03-22 13:07:22.748 (UTC+0100)] info/userland adding node: ns=1;s=002642a4-dc5d-432a-b8ba-ac69012aea6c
[2024-03-22 13:07:22.748 (UTC+0100)] trace/session TCP 0 | SC 0 | Session "Administrator" | Read attribute 13 of Node ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c
[2024-03-22 13:07:22.748 (UTC+0100)] debug/session TCP 0 | SC 0 | Session "Administrator" | AddNode (ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c): The value is empty. But this is only allowed for BaseDataType. Create a matching default value.
[2024-03-22 13:07:22.748 (UTC+0100)] trace/session TCP 0 | SC 0 | Session "Administrator" | Write attribute 13 of Node ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c
[2024-03-22 13:07:22.748 (UTC+0100)] trace/session TCP 0 | SC 0 | Session "Administrator" | Read attribute 8 of Node i=29
[2024-03-22 13:07:22.748 (UTC+0100)] warn/server Writing the value of Node ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c failed with the following reason: DataType of the value is incompatible
[2024-03-22 13:07:22.748 (UTC+0100)] info/session TCP 0 | SC 0 | Session "Administrator" | WriteRequest returned status code BadTypeMismatch
[2024-03-22 13:07:22.748 (UTC+0100)] info/session TCP 0 | SC 0 | Session "Administrator" | AddNode (ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c): Could not create a default value with StatusCode BadTypeMismatch
[2024-03-22 13:07:22.748 (UTC+0100)] info/session TCP 0 | SC 0 | Session "Administrator" | AddNode (ns=2;s=002642a4-dc5d-432a-b8ba-ac69012aea6c): Type-checking failed with error code BadTypeMismatch
[2024-03-22 13:07:22.748 (UTC+0100)] error/server Could not add the example nodeset. Check previous output for any error.
fish: Job 3, './serverWithmyNS' terminated by signal SIGABRT (Abort)
If that error message is correct, a default value is missing (originally in the XML nodeset, but here in the compiled nodeset). That would mean the nodesetLoader should complain about the missing default value too, instead of silently importing the nodeset without warnings/errors. Correct?
To reproduce, use issue_253.tgz with the following content:
issue253/
issue253/serverWithmyNS.c
issue253/myNS.h
issue253/serverWithmyNS
issue253/myNS.c
issue253/server
issue253/nodeset.xml
issue253/server.c
issue253/Makefile
I noticed that
UA_findDataTypeWithCustom()
can't find the data types of imported UAVariables with custom/aliased UADataTypes.Given the following namespaces:
Given these Aliases:
And this UADataType:
And this
UAVariableType
:And this
UAVariable
:(Sorry, I can't provide a full XML nodeset right now. But maybe this info is already enough.)
As preparation for
UA_Server_writeDataValue()
, my code can't find the data type by the type nodeIdAlarmStateStates
nor the type nodeIdns=2;s=af28ed20-dbb6-5624-aa65-4b42023ab1c4
(adjusted for runtime NS index) usingUA_findDataTypeWithCustom()
. Any ideas?