@@ -81,52 +85,6 @@ After this, you find the list of available demo apps in the (generated) README f
...
@@ -81,52 +85,6 @@ After this, you find the list of available demo apps in the (generated) README f
Most demo apps require CII Services be running on your host or on another host => Check that the related CII Services (e.g. config service for a a config demo app) are accessible: see [How-to start/stop CII Services](#how-to-start-stop-cii-services)
Most demo apps require CII Services be running on your host or on another host => Check that the related CII Services (e.g. config service for a a config demo app) are accessible: see [How-to start/stop CII Services](#how-to-start-stop-cii-services)
If disk usage is above 95%, elasticsearch goes into read-only mode, and creating new datapoints is not possible any more. To remove old content from the database, it is first necessary to create some free space on the disk (since the database needs space to perform deletetion-operations), then unlock the database, and then remove unnecessary old content from it.
In general, due to the many code generation steps taking place, your freedom in ICD file naming is limited.
The actual stalling comes from a failed MAL-communication with the CII Internal Configuration System, which likely is not running. Setting the timeout for the CiiConfigClient is therefore the thing to do. Note that the properties file (aka. "deployment config") takes precedence and will, if they overlap, overrule the programmatic (aka. "developer config") settings.
For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#KB%20PYBIND%20errors%20[ICD%20waf%20build]§ion-id={F524F9BE-F51D-4A01-9976-93359FCC4966}&page-id={0FEE4FB9-C58B-4E8A-A276-2EC4367CFB30}&end&base-path=https://europeansouthernobservatory.sharepoint.com/sites/ELT_Control/SiteAssets/ELT_Control%20Notebook/Documentation/ELT%20Control%20KnowledgeBase.one)
\[3\]<https://gitlab.eso.org/cii/srv/cii-srv/-/blob/master/oldb-client/cpp/oldb/src/provider/ciiOldbLocalFileProvider.hpp>*\[Note: not before DevEnv 3.4\]*
The cpp compiler runs out of memory and crashes. You can see the effect by running htop in a separate terminal, all memory (including swap space) is consumed by the g++ compiler, which consequently crashes.
Top Level Unexpected exception:
Traceback (most recent call last):
File "/home/eltdev/MODULES/test/app.py", line 91, in instantiateDP
File "/home/eltdev/MODULES/test/app.py", line 94, in instantiateDP
except CiiOldbPyB.CiiOldbDpExistsException:
NameError: name 'CiiOldbPyB' is not defined
```
**Solution**
_Memory needed for building a given ICD module_
You were mislead by the first backtrace: the exception name in the backtrace is not what you should catch.
There is a base load that is the same for all ICD modules. On top of that, the ICD file contents determine how much memory is needed to build the module.
In your code, replace "**CiiOldbPyB**" with "**elt.oldb**":
_Rule of Thumb_
| MAL version | Base Load | Mem per ICD-Struct |
| --- | ---- | ---- |
| MAL 1.x | 650 MB (2/3 GB) | 320 MB (1/3 GB) |
| MAL 2.0 | 650 MB (2/3 GB) | 110 MB (1/8 GB) |
```
Thus, if your biggest ICD contains 20 structs, building under MAL 1.x will require around 7 GB of available free memory.
try:
....
except elt.oldb.CiiOldbDpExistsException as e:
```
For completeness - do no forget this statement:
_Measuring_
Record metrics of the ICD build with this time-command:
```
```
import elt.oldb
$ alias time='TIME="real\t%E\nmem\t%Mk\ncpu\t%P\npf\t%F" time'
$ time waf build
[...]
real 10:28.19
mem 7206676k
cpu 765%
pf 166
```
```
**Background**
- If the build crashes, the time-command's output will not be fully reliable (the real memory need is higher than what the output shows).
- High page fault counts (`pf 1168635`) generally indicate you should reduce the module's footprint, see Solutions below.
The CII Python API is mostly a binding to the CII C++ API.
More info is available at [ECII-109](https://jira.eso.org/browse/ECII-109)
The CiiOldbPyB.CiiOldbDpExistsException is the original binding class.
This binding class is re-exported under the name elt.oldb.CiiOldbDpExistsException.
**Solution 1: Decrease the module's footprint**
The elt.oldb module internally loads the C++ binding module CiiOldbPyB. So both are the same exception.
1. Remove unnecessary middlewares
Nonetheless, you should use the re-exported name, not the original name in your application. We discourage the use of the original name because the structure of the CiiOldbPyB module is more "chaotic" and not equivalent to elt.oldb.
Use the `xyz_disabled` options:
```python
fromwtoolsimportmodule
# Disable OPCUA and DDS, since not part of this interface.
Unfortunately, in the backtraces you will always see the original name instead of the re-exported name.
2. Reduce build parallelism
This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECII-422).
By default the build system uses all cores on the host. Less parallelism means less memory consumers during the build. This is controlled by the waf `-j` option.
To build with only 4 cores:
` $ time waf -j4 build `
As a rough estimate, each waf build task will consume around 2 GB RAM, so on a 12 core host with 16 GB RAM, a parallelism of 8 may be a good choice. Try different numbers of cores and use the output from the time-command (see above) to find an optimum between real, page faults, and cpu.
Reduce the memory need by splitting the big ICDs up into 2 or more smaller ICD modules.
**Solution**
Run the following commands (you will be asked for the root pw):
**Solution 2: Increase the available memory**
```
1. Find RAM consumers and stop them, at least temporarily. For example, ElasticSearch uses a significant amount of RAM: `sudo cii-services stop elasticsearch`
I am certain that my ICD will never be used over OPC UA. Nonetheless, the ICD-compilation builds OPC UA mappings for my ICD. This is unnecessarily extending the compilation time for my application.
This fails because the datapoint "already exists":
**Solution**
By default the ICD-compilation builds mappings for all middlewares. But it is possible to exclude certain middleware mappings from compilation, which will reduce compilation time. You do this by passing mal options to the icd-generator.
**Example**
wscript
```
```
2021-06-22T11:01:33.003+0000, ERROR, CiiOldbRedisDataPointProvider/140709706681216, Data point uri: cii.oldb:/tcs/hb/tempser3 in Redis already exists.
When building an ICD using CII-MAL, you see this warning message:
```
```
CiiOldbPyB.CiiOldbException: De-serialization error:sizeof(T)\*count is greater then remaining
variable tracking size limit exceeded
```
```
Go directly to Solution 2 below.
**Background**
**Background**
The two errors are contradicting.
The -fvar-tracking-assignments is automatically enabled by GCC when optimizations are enabled.
Datapoints are stored in two databases: a document-database (permanent store) for its metadata, and a key-value-database (volatile store) for its current value. The above symptoms indicate that the two databases are out-of-sync, meaning the datapoint exists only "half".
There is a limit on how many variables can be tracked by the compiler. The warning tells you that more vars would need to be tracked than what's supported.
**Solution 1**
You can disable the tracking manually with -fno-var-tracking-assignments.
There is a good chance you can delete the datapoint to clean up the situation (as of [ECII-303](https://jira.eso.org/browse/ECII-303)):
There are two easy ways to do it on the overall project.
And then rerun “waf configure” and continue with the build.
If the above didn't help, find out which "half" of the datapoint exists:
Note: you have to have the exported variable each time you do a “waf configure” as that is the point at which such flags are saved
1. The current value exists, and the metadata is missing. This is the case when upgrading DevEnv/CII without deleting the Redis cache.
**Solution B**
Run the following command:
If you want it to be inside the project then put the flags fixed inside your project, so in the top level wscript (where you define the project) add this configure section before the project declaration:
Note: enter a search-expression matching the datapoint URI, in the example this is "tempser3".
If the command is showing the problematic key, we run a similar command to remove that key from the store:
```
# if so, delete the offending datapoint
redis-cli --scan --pattern *tempser3* | xargs redis-cli del
```
2. The metadata exists, and the current value is missing
Update: As of [ECII-303](https://jira.eso.org/browse/ECII-303), this should no longer be necessary, since the OLDB will make an attempt to automatically re-instate the current value that is missing.
**Solution 3**
If none of the above helped, another possibility is to clean up the metadata.
WARNING: This is an invasive operation. It deletes all datapoints in the OLDB.
```
# Clean up the OLDB databases
config-initEs.sh
oldb-initEs
redis-cli flushall
sudo cii-services stop config
sudo cii-services start config
```
If you are dealing with a multi-user oldb ("role_groupserver", meaning it serves an OLDB to a team of developers), after executing the above commands you need to additionally execute (with privileges):
I am certain that my ICD will never be used over OPC UA. Nonetheless, the ICD-compilation builds OPC UA mappings for my ICD. This is unnecessarily extending the compilation time for my application.
Trying to send a msg, I get the following error message from CII:
**Solution**
By default the ICD-compilation builds mappings for all middlewares. But it is possible to exclude certain middleware mappings from compilation, which will reduce compilation time. You do this by passing mal options to the icd-generator.
[libprotobuf ERROR google/protobuf/message_lite.cc:121] Can't parse message of type "generated.zpb.fcfif.StdCmds_Request" because it is missing required fields: data.Setup.payload[0].piezoData.input
```
```
The available options are:
My ICD definition looks like this
- opcua_disabled = if True, disable OPCUA middleware generation
- dds_disabled = if True, disable DDS middleware generation
- zpb_disabled = if True, disable ZEROMQ middleware generation
Trying to send a msg, I get the following error message from CII:
```
[libprotobuf ERROR google/protobuf/message_lite.cc:121] Can't parse message of type "generated.zpb.fcfif.StdCmds_Request" because it is missing required fields: data.Setup.payload[0].piezoData.input
```
My ICD definition looks like this
```xml
```xml
<enumname="PiezoInput">
<enumname="PiezoInput">
...
@@ -917,63 +728,10 @@ Your code does not work since you do not use union instance provided by the pare
...
@@ -917,63 +728,10 @@ Your code does not work since you do not use union instance provided by the pare
This issue was first described in [ECII-154](https://jira.eso.org/browse/ECII-154)
This issue was first described in [ECII-154](https://jira.eso.org/browse/ECII-154)
You are intending to read a config from the local config database ("localdb"), but you see an error message like this.
```
elt.config.exceptions.CiiConfigNoTcException: Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration cii.config://*/supervisoryapp/TrkLsvDeploy on the remote db was not found
at elt.config.client.ConfigRemoteDatabase.retrieveConfig(ConfigRemoteDatabase.java:191)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:354)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:310)
at trkLsv.DataContext.loadConfig(DataContext.java:324)
at trkLsv.DataContext.<init>(DataContext.java:190)
at trkLsv.TrkLsv.go(TrkLsv.java:72)
at trkLsv.TrkLsv.main(TrkLsv.java:41)
Caused by: elt.error.icd.CiiSerializableException
at elt.config.service.client.icd.zpb.ServiceClientApiInterfaceAsyncImpl.processRequest(ServiceClientApiInterfaceAsyncImpl.java:73)
at elt.mal.zpb.rr.ClientAsyncImpl.events(ClientAsyncImpl.java:261)
at org.zeromq.ZPoller.dispatch(ZPoller.java:537)
at org.zeromq.ZPoller.poll(ZPoller.java:488)
at org.zeromq.ZPoller.poll(ZPoller.java:461)
at elt.mal.zpb.ZpbMal.processThread(ZpbMal.java:459)
at elt.mal.zpb.ZpbMal.lambda$new$0(ZpbMal.java:119)
at java.lang.Thread.run(Thread.java:748)
```
**Solution A**
Your local file may be invalid (e.g. illegal format, or doesn't match the config class definition).
Look at the content of your local config database, e.g. with
```
$ find $INTROOT/localdb
```
and correct the file in place, or fix the source yaml and then redeploy it from source to the localdb.
**Background**
You may have a malformed json file in your local db, which the config service failed to read.
Because of the use the location wildcard "\*" in your code (in "cii.config://\*/supervisoryapp/TrkLsvDeploy"),
the config service has consequently tried to load the config from the remote config database, where no such config exists.
To that end, the error message is misleading, and should be improved (ticket [ECII-208](https://jira.eso.org/browse/ECII-208)).
at elt.mal.zpb.ps.ZpbSubscriber.requireMoreFrames(ZpbSubscriber.java:82)
at elt.mal.zpb.ps.ZpbSubscriber.events(ZpbSubscriber.java:114)
```
```
void elt.log.CiiLogManager.setLogLevel(
final String loggerName, final org.apache.logging.log4j.Level level);
**Background**
void elt.log.CiiLogManager.setLogLevel(
org.apache.logging.log4j.Logger logger, final org.apache.logging.log4j.Level level)
The first warning message indicates that your client has received a piece of data (= MAL entity type) on a channel that should not carry such data. This means you are running two publishers, publishing different types of data, on the same channel.
elt.mal.SchemeNotSupportedException: middleware not supported
Error: multiple XMLs found, just one supported.
```
```
while in fact you have only one XML file in your ICD directory.
**Solution A**
**Solution**
Check the file name of your ICD file:
make sure it starts with an uppercase letter.
**Background**
In your code, you've misspelled the middleware name, e.g. "opc" instead of "opcua"
The error message is misleading (will be improved, [ECII-426](https://jira.eso.org/browse/ECII-426)).
**Solution B**
The code generator for malicd_topics fails when the ICD file name starts with lowercase.
The middleware is supported in fact, but failed to load.
For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#KB%20PYBIND%20errors%20[ICD%20waf%20build]§ion-id={F524F9BE-F51D-4A01-9976-93359FCC4966}&page-id={0FEE4FB9-C58B-4E8A-A276-2EC4367CFB30}&end&base-path=https://europeansouthernobservatory.sharepoint.com/sites/ELT_Control/SiteAssets/ELT_Control%20Notebook/Documentation/ELT%20Control%20KnowledgeBase.one)
- E.g. in DDS, you are using a Qos profile xml file which has some illegal syntax inside.
...
@@ -1282,249 +1081,365 @@ For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#K
...
@@ -1282,249 +1081,365 @@ For more information, see also: [KB: PYBIND errors \[ICD waf build\]](onenote:#K
Trying to build an ICD-module or MAL-application, the build takes a long time, and/or fails with an error message like this:
I'm using MAL-DDS, and I have two network cards (NICs) installed. MAL uses the wrong one, i.e. my network traffic goes into the "office" network, but should go into the "control" network.
```
**Background**
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
```
```
As multicast addresses are by definition not associated with hardware (ie they map to MAC addresses which have no corresponding Ethernet card), there is no means for the OS to resolve which NIC the IGMP subscription should be sent down. Thus the NIC must be specified, or the default is used (which is the office network).
Therefore, DDS allows you to specify which NIC you want to use for outgoing traffic.
**Background**
Therefore, this boils down to configuring DDS.
The cpp compiler runs out of memory and crashes. You can see the effect by running htop in a separate terminal, all memory (including swap space) is consumed by the g++ compiler, which consequently crashes.
**Solution**
_Memory needed for building a given ICD module_
1. Get the XML file shown in Solution #1 on this page:
There is a base load that is the same for all ICD modules. On top of that, the ICD file contents determine how much memory is needed to build the module.
i\) put the desired config into an external XML file
By default the build system uses all cores on the host. Less parallelism means less memory consumers during the build. This is controlled by the waf `-j` option.
ii\) define the FASTRTPS_DEFAULT_PROFILES_FILE (Connext: NDDS_QOS_PROFILES) environment variable, so DDS finds the XML file
To build with only 4 cores:
` $ time waf -j4 build `
As a rough estimate, each waf build task will consume around 2 GB RAM, so on a 12 core host with 16 GB RAM, a parallelism of 8 may be a good choice. Try different numbers of cores and use the output from the time-command (see above) to find an optimum between real, page faults, and cpu.
iii\) pass 2 keys to the MAL factory, so DDS finds the right profile in the XML file
*(For a discussion about making this easier, see [ECII-77](https://jira.eso.org/browse/ECII-77))*
3. Adjust the compiler flags
**Solution**
The default set of compiler flags applied by the build system consume significant memory.
We recommend using "-O2 -flto -pipe" (_to be confirmed_) instead. This is how you pass custom compiler flags for your ICD-module:
In your project wscript:
1. Create the XML file.
~~~python
fromwtoolsimportproject
[...]
defconfigure(cnf):
cnf.env.CXXFLAGS_MALPYTHON='-O2 -flto -pipe'
[...]
~~~
4. Refactor your ICD
Examples are easily found in the "Fast DDS" documentation and user forums.
Reduce the memory need by splitting the big ICDs up into 2 or more smaller ICD modules.
2. In your code, let MAL load the DDS-specific properties.
**Solution 2: Increase the available memory**
Example (C++):
1. Find RAM consumers and stop them, at least temporarily. For example, ElasticSearch uses a significant amount of RAM: `sudo cii-services stop elasticsearch`
This article covers integration of OPC/UA in CII MAL specifically for OPC/UA Data Access and Subscription profiles. OPC/UA method invocation is also supported in CII MAL but is not described in this article, likewise details of the Python (and Java) support are not provided. Only C++ is considered here.
OPC/UA communication middleware is exposed in CII MAL as either Publish/Subscribe or Request/Reply APIs.
The XML ICD definition of types in CII is used to map sets of data points together that are read/written as a group.
Each attribute in the defined type is connected to a corresponding data point in the OPC/UA data space via a URI. Thus the CII URI for a complex type will contain specific addresses of multiple nodes in the OPC/UA data space.
Increase your RAM, respectively ask your system administrator to do it. Assess the necessary amount by using the "Rule Of Thumb" above.
The CII MAL Pub/Sub API utilizes OPC/UA Data Access Reads and Writes, as well OPC/UA subscription. A Publisher will directly trigger an OPC DA write, while a Subscriber will work in one of two ways, depending on the type associated with the subscriber:
In your application you get errors like this:
- If the subscribers CII URI contains only a single node (i.e. the XML ICD type contained only a single attribute) then the Subscriber will create an OPC/UA subscription on that data point. The subscription will trigger notification of updates to the data point node, which will then be queued for notification via the CII Subscriber API.
- If the Subscriber is using subscription, the opc.ps.outstandingPublishRequests property should not be zero (e.g. set it to 5), see the example code below. The reason is that the publish queue is used to store and send subscription notification events, and if the queue is small the even notifications may simply be dropped.
- If the subscriber CII URI contains multiple nodes (i.e. the XML ICD type contains multiple attributes) then the Subscriber launches a thread to perform periodic polling of data from the OPC/UA server. The rate is based on the properties passed in creating the subscriber. e.g.
As OPC/UA Data Access read and write essentially follow a synchronous request/reply pattern, CII MAL also provides this interface for OPC/UA clients.
at elt.mal.zpb.ps.ZpbSubscriber.requireMoreFrames(ZpbSubscriber.java:82)
The ICD is termed "virtual" in CII nomenclature as it does not require definition as an XML ICD using the service syntax, rather the same types defined for the Pub/Sub API may be used with a CII MAL OPC/UA Request/Reply.
at elt.mal.zpb.ps.ZpbSubscriber.events(ZpbSubscriber.java:114)
This approach means OPC/UA Data Access read (and write) are synchronous, and may be called as needed by the application.
The first warning message indicates that your client has received a piece of data (= MAL entity type) on a channel that should not carry such data. This means you are running two publishers, publishing different types of data, on the same channel.
If disk usage is above 95%, elasticsearch goes into read-only mode, and creating new datapoints is not possible any more. To remove old content from the database, it is first necessary to create some free space on the disk (since the database needs space to perform deletetion-operations), then unlock the database, and then remove unnecessary old content from it.
When starting an application using the OLDB API, the following exception is received:
```
```
zpb.ps://134.171.2.220:57110/test2
<date/time>, ERROR, CiiOldbFactory/140635105143296, Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
terminate called after throwing an instance of 'elt::oldb::CiiOldbException'
what(): Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
```
```
**Solution**
This can indicate that elasticSearch on the config/oldb server is not running, or has crashed.
Use cii-services command to check the status on the server where the (cii-internal) config is running.
Another instance of your application has non-gracefully terminated without freeing the network port.
The actual stalling comes from a failed MAL-communication with the CII Internal Configuration System, which likely is not running. Setting the timeout for the CiiConfigClient is therefore the thing to do. Note that the properties file (aka. "deployment config") takes precedence and will, if they overlap, overrule the programmatic (aka. "developer config") settings.
Ensure your application always performs a call to "mal.close()" on shutdown.
\[3\]<https://gitlab.eso.org/cii/srv/cii-srv/-/blob/master/oldb-client/cpp/oldb/src/provider/ciiOldbLocalFileProvider.hpp>*\[Note: not before DevEnv 3.4\]*
Running your application, you get this error message:
My application tries to create an OLDB datapoint.
This fails because the datapoint "already exists":
```
```
elt.mal.SchemeNotSupportedException: middleware not supported
2021-06-22T11:01:33.003+0000, ERROR, CiiOldbRedisDataPointProvider/140709706681216, Data point uri: cii.oldb:/tcs/hb/tempser3 in Redis already exists.
```
```
**Solution A**
In response, my application skips the creation step, and wants to use the reportedly existing datapoint.
In your code, you've misspelled the middleware name, e.g. "opc" instead of "opcua"
However, when doing this, I get the error "Datapoint doesn't exist".
**Solution B**
Likewise, when I run the oldb-gui database browser, it does not show this data point in the OLDB.
The middleware is supported in fact, but failed to load.
**Variant 2 of the Problem**
- E.g. in DDS, you are using a Qos profile xml file which has some illegal syntax inside.
I try to access an OLDB datapoint, and I see two errors like this:
```
Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration
[…]
elt.oldb.exceptions.CiiOldbDpExistsException: Data point cii.oldb:/alarm/alarm/device/motor/input_int_dp_alarm already exisits.
```
Go directly to Solution 2 below.
**Variant 3 of the Problem**
I try to delete an OLDB datapoint and I see an error like this:
```
CiiOldbPyB.CiiOldbException: De-serialization error:sizeof(T)\*count is greater then remaining
```
Go directly to Solution 2 below.
**Background**
The two errors are contradicting.
Datapoints are stored in two databases: a document-database (permanent store) for its metadata, and a key-value-database (volatile store) for its current value. The above symptoms indicate that the two databases are out-of-sync, meaning the datapoint exists only "half".
**Solution 1**
There is a good chance you can delete the datapoint to clean up the situation (as of [ECII-303](https://jira.eso.org/browse/ECII-303)):
If the above didn't help, find out which "half" of the datapoint exists:
1. The current value exists, and the metadata is missing. This is the case when upgrading DevEnv/CII without deleting the Redis cache.
Run the following command:
Note: enter a search-expression matching the datapoint URI, in the example this is "tempser3".
```
# confirm that this is the cause of the problem
redis-cli KEYS *tempser3*
```
If the command is showing the problematic key, we run a similar command to remove that key from the store:
```
# if so, delete the offending datapoint
redis-cli --scan --pattern *tempser3* | xargs redis-cli del
```
2. The metadata exists, and the current value is missing
Update: As of [ECII-303](https://jira.eso.org/browse/ECII-303), this should no longer be necessary, since the OLDB will make an attempt to automatically re-instate the current value that is missing.
**Solution 3**
If none of the above helped, another possibility is to clean up the metadata.
WARNING: This is an invasive operation. It deletes all datapoints in the OLDB.
```
# Clean up the OLDB databases
config-initEs.sh
oldb-initEs
redis-cli flushall
sudo cii-services stop config
sudo cii-services start config
```
If you are dealing with a multi-user oldb ("role_groupserver", meaning it serves an OLDB to a team of developers), after executing the above commands you need to additionally execute (with privileges):
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import elt.oldb
>>> from elt.config import Uri
>>> oldb = elt.oldb.CiiOldbFactory.get_instance()
```
**Problem**
… and, to create a datapoint:
I'm using MAL-DDS, and I have two network cards (NICs) installed. MAL uses the wrong one, i.e. my network traffic goes into the "office" network, but should go into the "control" network.
>>> oldb.create_data_point_by_value (Uri("cii.oldb:/ccs/tst/tmp1"), "my text")
```
**Background**
… and, to read a datapoint:
As multicast addresses are by definition not associated with hardware (ie they map to MAC addresses which have no corresponding Ethernet card), there is no means for the OS to resolve which NIC the IGMP subscription should be sent down. Thus the NIC must be specified, or the default is used (which is the office network).
CiiOldbPyB.CiiOldbDpExistsException: The Data point cii.oldb:/root/test/xxxdp already exists.
```
```
**Background**
Therefore, I added a corresponding try-catch around my call:
The -fvar-tracking-assignments is automatically enabled by GCC when optimizations are enabled.
There is a limit on how many variables can be tracked by the compiler. The warning tells you that more vars would need to be tracked than what's supported.
You can disable the tracking manually with -fno-var-tracking-assignments.
```
try:
...
except CiiOldbPyB.CiiOldbDpExistsException as e:
```
There are two easy ways to do it on the overall project.
When I run it, the try-catch doesn't work.
**Solution A**
Moreover, I now get two backtraces:
```
```
Export CXXFLAGS=-fno-var-tracking-assignments
Top Level Unexpected exception:
Traceback (most recent call last):
File "/home/eltdev/MODULES/test/app.py", line 91, in instantiateDP
File "/home/eltdev/MODULES/test/app.py", line 94, in instantiateDP
except CiiOldbPyB.CiiOldbDpExistsException:
NameError: name 'CiiOldbPyB' is not defined
```
```
And then rerun “waf configure” and continue with the build.
**Solution**
Note: you have to have the exported variable each time you do a “waf configure” as that is the point at which such flags are saved
You were mislead by the first backtrace: the exception name in the backtrace is not what you should catch.
**Solution B**
In your code, replace "**CiiOldbPyB**" with "**elt.oldb**":
If you want it to be inside the project then put the flags fixed inside your project, so in the top level wscript (where you define the project) add this configure section before the project declaration:
The elt.oldb module internally loads the C++ binding module CiiOldbPyB. So both are the same exception.
Nonetheless, you should use the re-exported name, not the original name in your application. We discourage the use of the original name because the structure of the CiiOldbPyB module is more "chaotic" and not equivalent to elt.oldb.
Unfortunately, in the backtraces you will always see the original name instead of the re-exported name.
This question was originally asked in [ECII-422](https://jira.eso.org/browse/ECII-422).
This article covers integration of OPC/UA in CII MAL specifically for OPC/UA Data Access and Subscription profiles. OPC/UA method invocation is also supported in CII MAL but is not described in this article, likewise details of the Python (and Java) support are not provided. Only C++ is considered here.
OPC/UA communication middleware is exposed in CII MAL as either Publish/Subscribe or Request/Reply APIs.
The XML ICD definition of types in CII is used to map sets of data points together that are read/written as a group.
Each attribute in the defined type is connected to a corresponding data point in the OPC/UA data space via a URI. Thus the CII URI for a complex type will contain specific addresses of multiple nodes in the OPC/UA data space.
The CII MAL Pub/Sub API utilizes OPC/UA Data Access Reads and Writes, as well OPC/UA subscription. A Publisher will directly trigger an OPC DA write, while a Subscriber will work in one of two ways, depending on the type associated with the subscriber:
- If the subscribers CII URI contains only a single node (i.e. the XML ICD type contained only a single attribute) then the Subscriber will create an OPC/UA subscription on that data point. The subscription will trigger notification of updates to the data point node, which will then be queued for notification via the CII Subscriber API.
- If the Subscriber is using subscription, the opc.ps.outstandingPublishRequests property should not be zero (e.g. set it to 5), see the example code below. The reason is that the publish queue is used to store and send subscription notification events, and if the queue is small the even notifications may simply be dropped.
- If the subscriber CII URI contains multiple nodes (i.e. the XML ICD type contains multiple attributes) then the Subscriber launches a thread to perform periodic polling of data from the OPC/UA server. The rate is based on the properties passed in creating the subscriber. e.g.
**Problem**
```java
You are intending to read a config from the local config database ("localdb"), but you see an error message like this.
elt.config.exceptions.CiiConfigNoTcException: Target configuration does not exist: Failed to retrieve configuration from elastic search: Configuration cii.config://*/supervisoryapp/TrkLsvDeploy on the remote db was not found
at elt.config.client.ConfigRemoteDatabase.retrieveConfig(ConfigRemoteDatabase.java:191)
at elt.config.client.CiiConfigClient.retrieveConfig(CiiConfigClient.java:354)
at trkLsv.DataContext.<init>(DataContext.java:190)
#### Request/Reply API for OPC/UA Clients:
at trkLsv.TrkLsv.go(TrkLsv.java:72)
at trkLsv.TrkLsv.main(TrkLsv.java:41)
As OPC/UA Data Access read and write essentially follow a synchronous request/reply pattern, CII MAL also provides this interface for OPC/UA clients.
Caused by: elt.error.icd.CiiSerializableException
at elt.config.service.client.icd.zpb.ServiceClientApiInterfaceAsyncImpl.processRequest(ServiceClientApiInterfaceAsyncImpl.java:73)
The ICD is termed "virtual" in CII nomenclature as it does not require definition as an XML ICD using the service syntax, rather the same types defined for the Pub/Sub API may be used with a CII MAL OPC/UA Request/Reply.
at elt.mal.zpb.rr.ClientAsyncImpl.events(ClientAsyncImpl.java:261)
at org.zeromq.ZPoller.dispatch(ZPoller.java:537)
This approach means OPC/UA Data Access read (and write) are synchronous, and may be called as needed by the application.
at org.zeromq.ZPoller.poll(ZPoller.java:488)
at org.zeromq.ZPoller.poll(ZPoller.java:461)
```cpp
at elt.mal.zpb.ZpbMal.processThread(ZpbMal.java:459)
namespacemal{
at elt.mal.zpb.ZpbMal.lambda$new$0(ZpbMal.java:119)
When starting an application using the Config client API and the following exception is received:
Because of the use the location wildcard "\*" in your code (in "cii.config://\*/supervisoryapp/TrkLsvDeploy"),
```
<date/time>, ERROR, CiiOldbFactory/140635105143296, Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
terminate called after throwing an instance of 'elt::oldb::CiiOldbException'
what(): Unexpected config exception occurred while retrieving configuration for cii.config://remote/oldb/configurations/oldbClientConfig What:Path oldb/configurations/oldbClientConfig, version -1 not found
```
*info*
the config service has consequently tried to load the config from the remote config database, where no such config exists.
This can indicate that elasticSearch on the config/oldb server is not running, or has crashed.
Use cii-services command to check the status on the server where the config is running.
To that end, the error message is misleading, and should be improved (ticket [ECII-208](https://jira.eso.org/browse/ECII-208)).