DDS_PreconditionNotMet error on reader.take()

2 posts / 0 new
Last post
Offline
Last seen: 4 months 1 week ago
Joined: 12/05/2023
Posts: 1
DDS_PreconditionNotMet error on reader.take()

Hello,

I am facing a problem with RTI DDS 6.1.0 in C#, when calling reader.take() I sometimes get a DDS_PreconditionNotMet. When this error occurs, I see that the received_data length and the info_seq length are different (usually received_data length is 0 and info_seq 1 or more). Once the error appear once, it is thrown on every following call of take();

I use a reliable qos profile with a keep_last_history and a depth of 1.

For info, I call reader.take() in a tick of 30ms and I get this error after about 5 minuts of reading data.

I've search online and found nothing about this issue so I hope that someone here could help me figure out why I have it.

Romain

Howard's picture
Offline
Last seen: 21 hours 34 min ago
Joined: 11/29/2012
Posts: 567

Hi Romain,

The full documentation for DataReader::take() can be found here (in the C version of the API).  And if you look for DDS_RETCODE_PRECONDITION_NOT_MET, you'll find a variety of ways in which calling take() will return that exception.

Running out of memory is possible, in your code how are you doing the take()?  Are the LoanedSamples<> that you are take()ing, being "returned"...i.e, going out of scope after you've done processing them?  The LoanedSamples<> are references to the samples stored in the DataReader's receive cache/queue.

If the code holds onto the samples indefinitely (i.e. not doing a copy, but holding a reference), then the DataReader never gets that memory back to store more data and when memory is exhausted, the precondition error will be hit.

There are other reasons that the precondition error is thrown.  You might want to look at those to see which ones you may be hitting.

Another thing you can do it to increase the verbosity of Connext.  That could give you some clues of what's happened when the exception is thrown.