PreconditionNotMetError while waiting for waitset

2 posts / 0 new
Last post
Offline
Last seen: 1 month 1 week ago
Joined: 03/12/2018
Posts: 32
PreconditionNotMetError while waiting for waitset

I have some code that waits on a WaitSet in a loop, looking for DDS data, and dispatching to a handler function when it gets it.

dds::core::cond::WaitSet waitSet;
dds::sub::cond::ReadCondition readCondition(commandReader_,
dds::sub::status::DataState::any(), std::bind(&ReceiverNode::handleCommands, this));

waitSet += readCondition;
waitSet += guardCondition_;
while (!isShuttingDown())
{
    try
    {
        waitSet.dispatch();

    }
    catch...

It is able to use this waitset to detect incoming DDS data, and it responds by successfully sending a DDS packet. 

However, when it returns to wait for the waitset, it gets a PreconditionNotMetError exception, with the string "Invalid data" in the what() call.

This would seem to be catastrophic, something went terribly wrong, right?  Except when it returns to wait at the WaitSet, everything is fine, and it gets the next piece of data.

The documentation suggests that this error could be happening if more than one thread is waiting on a waitset.  But this does not appear to the case.

Again, the order is:l

listenForCommands: Waiting on waitSet
listenForCommands: Back from waiting on waitSet
listenForCommands: Waiting on waitSet
listenForCommands: PreconditionNotMetError while waiting for waitset
listenForCommands: Exception info: Invalid data
listenForCommands: Waiting on waitSet

 Can anyone suggest something I check to debug why I am getting this exception?
 
Offline
Last seen: 1 month 1 week ago
Joined: 03/12/2018
Posts: 32

I should add the following notes:

  • The application that sends DDS messages to the application described above has to send the message quite a few times before this application will receive it (usually 8 or 9 tries, with a second in between).  I've no idea why it takes so many tries... the data packet is small.  The QoS is "BuiltinQosLibExp::Generic.StrictReliable.LowLatency".  I see the packets on the admin console, but somehow the application doesn't.

  • I tried removing the GuardCondition from the waitset and it didn't make a difference.