I have a class that is running as a daemon that as part of the class sends a results file through an RTI DDS message with the writer being a guranteed writer.
My question is the follwing, I do not want this class to ever be stuck forever since that will cause issues with the program and lock the program up. With that in mind, if the guranteed writer ever can't find anywhere to write the message to will the whole class just lock up due to a blocking call until the message is sent, or does RTI hand off the sending of the message to some under the cover threads that make this scenario impossible?
Hi,
No, a DDS DataWriter will not block if has no matched DataReaders, it will just put the data in its history cache and return. Blocking occurs when there are unresponsive reliable DataReaders that are not keeping up with the flow.
The situations under which the
DataWriter::write()
operation may block are documented in the API documentation for that call. See:https://community.rti.com/static/documentation/connext-dds/5.2.0/doc/api/connext_dds/api_cpp/structFooDataWriter.html#abb3770f202340bc819368463987eb055
To sum it up to avoid blocking a reliable DataWriter you need to configure
DDS_HistoryQosPolicyKind to DDS_KEEP_LAST_HISTORY_QOS:
and
DDS_ResourceLimitsQosPolicy::max_samples >= DDS_ResourceLimitsQosPolicy::max_instances *DDS_HistoryQosPolicy::depth
Alternatively, you can control the maximum blocking using the RELIABILITY
max_blocking_time
. Thos Qos policy configures the maximum time the write operation may block (waiting for space to become available). Ifmax_blocking_time
elapses before the DDSDataWriter is able to store the modification without exceeding the limits, the operation will time out and return (DDS_RETCODE_TIMEOUT), so it will not be "stuck forever"Gerardo
Hello,
Sorry for reviving this thread. I have a positive history depth with a reliable data writer. Unfortunately, it happens that my (non-async) datawriter blocks forever. No timeout exception is ever thrown.
All resource settings are the default.
How can I approach and debug this problem?
Best regards,
Andreas