Python: rti_connector.close() does not cleanup properly

6 posts / 0 new
Last post
Offline
Last seen: 10 months 1 week ago
Joined: 01/27/2021
Posts: 3
Python: rti_connector.close() does not cleanup properly

Hello everyone,

Does anyone get into a same problem like me?

I can successfully create a rti connector and close it using close method. But I cannot recreate the same connector afterwards. The error message is like below.

DDS_PropertySeq_add_or_assert_element:!new element. ELEMENT ALREADY EXISTS. EITHER REMOVE THIS CALL OR CALL assert_element INSTEAD.
DDS_PropertyQosPolicyHelper_add_property:!add element
RTI Connector Unable to access RTI Data Distribution Service Core Libraries
See www.rti.com for more information.
RTIDDSConnector_newI:!new unable to add license
RTIDDSConnector_EntitiesLookupList_delete:RTIDDSConnector
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/xp/.local/lib/python2.7/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1364, in open_connector
    connector = Connector(config_name, url)
  File "/home/xp/.local/lib/python2.7/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 1237, in __init__
    _check_entity_creation(self.native, "Connector")
  File "/home/xp/.local/lib/python2.7/site-packages/rticonnextdds_connector/rticonnextdds_connector.py", line 93, in _check_entity_creation
    + _get_last_dds_error_message())
rticonnextdds_connector.rticonnextdds_connector.Error: Failed to create Connector:
 DDS_PropertySeq_add_or_assert_element:!new element. ELEMENT ALREADY EXISTS. EITHER REMOVE THIS CALL OR CALL assert_element INSTEAD.
  DDS_PropertyQosPolicyHelper_add_property:!add element
   RTIDDSConnector_newI:!new unable to add license
    RTIDDSConnector_EntitiesLookupList_delete:RTIDDSConnector

 

It seems that one program can only create a connector once. I can not create anther connector using different xml config either.

Offline
Last seen: 54 min 18 sec ago
Joined: 10/22/2018
Posts: 78

Please can you provide me with the XML you are using?

Offline
Last seen: 10 months 1 week ago
Joined: 01/27/2021
Posts: 3

<?xml version="1.0" encoding="UTF-8"?>
<dds
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_dds_profiles.xsd"
    version="6.0.0">
<types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:////opt/toolchains/rti_connext_dds-6.0.0/bin/../resource/app/app_support/rtiddsgen/schema/rti_dds_topic_types.xsd">
<include file="SensorID.xml"/>
<include file="primitives.xml"/>
<include file="base_msg.xml"/>
<module name="xpilot">
  <module name="msg">
    <module name="camera_service">
      <struct name= "CameraImage" baseType="xpilot::msg::BaseMsg">
        <member name="camera_id" type="nonBasic"  nonBasicTypeName= "xpilot::msg::SensorID"/>
        <member name="width" type="uint16"/>
        <member name="height" type="uint16"/>
        <member name="size" type="uint32"/>
        <member name="format" type="nonBasic"  nonBasicTypeName= "xpilot::msg::ImageFormat"/>
        <member name="offset" type="uint16"/>
        <member name="data" sequenceMaxLength="2000000" type="byte"/>
        <member name="metadata" sequenceMaxLength="15360" type="byte"/>
      </struct>
    </module>
  </module>
</module>
</types>
<qos_library name="XplorerParticipantQosLib">
    <!-- Topic-specific QosProfile, used by all interfaces -->
    <qos_profile name="XplorerPythonBestEffort" base_name="BuiltinQosLibExp::Generic.BestEffort">
        <participant_qos>
            <resource_limits>
                <type_object_max_serialized_length>10000</type_object_max_serialized_length>
            </resource_limits>
            <property>
                <value>
                    <element>
                        <name>dds.transport.shmem.builtin.parent.message_size_max</name>
                        <value>65536</value>
                    </element>
                    <element>
                        <name>dds.transport.shmem.builtin.receive_buffer_size</name>
                        <value>7168000</value>
                    </element>
                <!-- Filter out the appropriate network interfaces -->
<!--
                    <element>
                        <name>dds.transport.UDPv4.builtin.parent.deny_interfaces</name>
                        <value>$(NDDS_TRANSPORT_UDPV4_DENY_INTERFACES)</value>
                    </element>
                    <element>
                        <name>dds.transport.UDPv4.builtin.parent.allow_interfaces</name>
                        <value>$(NDDS_TRANSPORT_UDPV4_ALLOW_INTERFACES)</value>
                    </element>
-->
                </value>
            </property>
        </participant_qos>
    </qos_profile>

    <!-- Interface-specific QosProfile for a publisher -->
    <qos_profile name="XplorerPythonBestEffort.Pub" base_name="XplorerPythonBestEffort">
     <participant_qos/>
    </qos_profile>

    <!-- Interface-specific QosProfile for a subscriber -->
    <qos_profile name="XplorerPythonBestEffort.Sub" base_name="XplorerPythonBestEffort">
      <participant_qos/>
    </qos_profile>

  </qos_library>
  <domain_library name="XplorerDomainPythonLib">
    <domain name="XplorerDomainPython" domain_id="$(NDDS_DOMAIN_ID)">
      <register_type name="CameraImageType" type_ref="xpilot::msg::camera_service::CameraImage"/>
      <topic name="CameraImageTopic" register_type_ref="CameraImageType"/>

    </domain>
  </domain_library>

  <domain_participant_library name="XplorerParticipantLib">

    <domain_participant name="XplorerParticipantCamera.Sub" domain_ref="XplorerDomainPythonLib::XplorerDomainPython">
      <subscriber name="CameraSubscriber">
        <data_reader name="CameraImageTopicReader" topic_ref="CameraImageTopic">
          <datareader_qos base_name="XplorerParticipantQosLib::XplorerPythonBestEffort.Sub"/>
        </data_reader>
        <subscriber_qos base_name="XplorerParticipantQosLib::XplorerPythonBestEffort.Sub"/>
        
      </subscriber>
      <participant_qos base_name="XplorerParticipantQosLib::XplorerPythonBestEffort.Sub"/>
    </domain_participant>
  </domain_participant_library>
  </dds>

Offline
Last seen: 54 min 18 sec ago
Joined: 10/22/2018
Posts: 78

I believe you may be runnig into an issue which is fixed in our next release of Connector. To confirm please could you do the following:


Remove the <participant_qos> tags which are within the entity definitions. I.e., the only <participant_qos> tag remaining should be within the <qos_profile> XML tag.


Also, change the definition of the qos profile to:

<qos_profile name="XplorerPythonBestEffort" base_name="BuiltinQosLibExp::Generic.BestEffort" "is_default_qos="true">

Please let me know if this workaround fixes your issue.

Offline
Last seen: 10 months 1 week ago
Joined: 01/27/2021
Posts: 3

It works! Thank you! You literally save my day!

Offline
Last seen: 54 min 18 sec ago
Joined: 10/22/2018
Posts: 78

No problem.
This is a known issue that is fixed in our next release of Connector.

Sam