Search code examples
resourcesmessagingqosdata-distribution-service

Can't figure out the root cause of out of resources error


I have an application using RTI DDS using dynamic data to set my messages.

When I try to send a string that was 300kb in a file I get the following error code:

com.rti.dds.infrastructure.RETCODE_OUT_OF_RESOURCES
    at com.rti.dds.util.Utilities.rethrow(Unknown Source) ~[nddsjava.jar:?]
    at com.rti.dds.infrastructure.RETCODE_ERROR.check_return_codeI(Unknown Source) ~[nddsjava.jar:?]
    at com.rti.dds.dynamicdata.DynamicData.set_string(Unknown Source) ~[nddsjava.jar:?]

I have searched on their forum and tried all changes I can think of to my QOS policy file to avoid this error, of which none have worked.

I figured the best way to now go about solving this problem is getting to the root cause of the problem, however I have hit a wall and can't figure out if it is OS related, a memory leak, or what.

Does anyone have any idea what may be causing me this issue with RTI DDS?


Solution

  • In your comment, you indicated that you solved the problem. It might still be useful for others to learn about it as well, especially given that the situation depends on the Connext version that you use. Hence my answer here.

    The DynamicData() constructor for the com.rti.dds.dynamicdata.DynamicData object has a parameter called type of the class TypeCode and a parameter called property of the class DynamicDataProperty_t. The latter configures the behavior of the newly created object, in particular with respect to memory allocations and resource limits.

    Apparently, you used the value com.rti.dds.dynamicdata.DYNAMIC_DATA_PROPERTY_DEFAULT as the property parameter. For older versions of RTI's product (before 5.2.0), this meant that the buffer_max_size attribute was set to the value of 65536 bytes. This was not enough for your object, with an RETCODE_OUT_OF_RESOURCES exception as a result. The solution is to pass your own instantiation of the property object and set the buffer_max_size to a large enough value.

    For the current version of the product, this is no longer required. The default value for buffer_max_size is now ResourceLimitsQosPolicy.LENGTH_UNLIMITED, indicating that there is no maximum size to the buffer.