Hey there,
I'm trying to create an application that sends the node's information of a Kubernetes cluster. This application runs on a docker container executed in the cluster and gathers the required information (CPU, etc.). Once the application has the info, it sends it to other elements through rticonnextdds-connector python. Thus, I configured a datawriter to do that. Moreover, I also configured a datareader to receive some information from external components. Then, I enable only a participant with the datawriter and datareader previously mentioned. I have attached the .XML file with the whole configuration.
My application has several classes, and one of them is named DDS_Algo (see dds.txt file). I create an instance of DDS_Algo class from my main class to create the connector, the output and the input elements. In this manner, I can use the output element to send information through DDS from my main class. Meanwhile, in a parallel process, I execute a method of DDS_Algo class to read any information with the input element.
In the beginning, everything appears to work fine, but then there is an error that stops the reader's execution. I searched for any clue, but unfortunately, I could not solve my problem.
The app's output and the error are as follows:
<function Connector.get_version at 0x7fcfcfec75b0>
Waiting for publications...
{'name': 'kubernetes-control-plane1-dw'}
Waiting for data...
{'name': 'kubernetes-control-plane1-dr'}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 2}
{'Identificador': 'Node_Status', 'NodeId': 'kind-control-plane', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 2}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 2}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker2', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 2}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker3', 'TerminationPointId': '0.0', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'name': 'kubernetes-control-plane1-dr'}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 1}
{'Identificador': 'Node_Status', 'NodeId': 'kind-control-plane', 'TerminationPointId': '927.1178', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 0, 'length': 3}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker', 'TerminationPointId': '100.2001', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 1, 'length': 3}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker2', 'TerminationPointId': '100.0852', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'input': <rticonnextdds_connector.rticonnextdds_connector.Input object at 0x7fcfcff68460>, 'index': 2, 'length': 3}
{'Identificador': 'Node_Status', 'NodeId': 'kind-worker3', 'TerminationPointId': '100.3094', 'LinkId': '', 'SourceNode': '0', 'SourceNodeTp': '', 'DestinationNode': 'kubernetes-control-plane1', 'DestinationNodeTp': ''}
{'name': 'kubernetes-control-plane1-dr'}
RTILuaMetamethodImpl_InDataIndexing:index must be > 0
Exception in thread Thread-6 (read_samples):
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "/app/dds.py", line 219, in read_samples
for sample in self.reader.samples.valid_data_iter:
File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 782, in __next__
while self.index + 1 < self.length and not self.input.infos.isValid(self.index + 1):
File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 599, in isValid
_check_retcode(retcode)
File "/usr/local/lib/python3.10/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 89, in _check_retcode
raise Error("DDS Exception: " + _get_last_dds_error_message())
rticonnextdds_connector.rticonnextdds_connector.Error: DDS Exception:
RTILuaMetamethodImpl_InDataIndexing:index must be > 0
I hope that anyone can help me because at this moment I'm blocked.
I appreciate any help you can provide.
Alex
Attachment | Size |
---|---|
DDS_Algo class | 3.41 KB |
dds_entities_configuration file | 7.28 KB |
executed method in main class to send the node's information | 1.35 KB |
I see you are using multiple threads to access to Connector. Connector is not thread safe, concurrent calls need to be protected. There is more information here.
Thank you for your quick response.
I struggled to understand what could happen and never thought of that possibility.
It worked!!! You save my day. Thanks again.