RETCODE_NO_DATA

4 posts / 0 new
Last post
Offline
Last seen: 1 year 8 months ago
Joined: 04/28/2013
Posts: 38
RETCODE_NO_DATA

Hello,

I'm having an issue with take_untyped and read_untyped functions called from on_data_arrival, in that they sometimes return RETCODE_NO_DATA (can get up to 100 times in a few minutes)

From what i've read in the documentation, it seems that there is no erronous behavior here, but I'm wondering how is it possible that there is no data if on_data_arrival was called?

(I'm assuming that the behavior is normal, judging from the example in http://community.rti.com/rti-doc/45f/ndds.4.5f/doc/pdf/RTI_Connext_UsersManual.pdf figure 7-10 Simple DataReader)

 

Thanks,

Michael

 

Gerardo Pardo's picture
Offline
Last seen: 2 weeks 5 days ago
Joined: 06/02/2010
Posts: 589

Hi,

As you said this is not indicative of an error. There are several 'normal' situations that can result on this. See below. This may not be an exhaustive list:

  • The SampleState, ViewState, or InstanceState masks that you are passing to read/take are maskign the samples that are there. This would not be the case of course if you use the "ANY" masks shown in the figure 7-10 you mentioned.
  • If you are waking up from a WaitSet on the ON_DATA_AVALIABLE status condition and you have multiple threads calling read/take from the same DataReader it is possible that by the time a particular thread wakes up another has taken the data. However this will not happen if you call read/take from the on_data_available inside the Listener because this is called from the internal "receive thread" before any other thread can access the DataReader.
  • If you are using PRESENTATION access_scope DDS_GROUP_PRESENTATION_QOS and you are setting ordered_access to TRUE. Then in order to esure the data is accessed in order across the different DataReaders inside the Subscriber the read/take operation will return false if the next unread sample does not belong to that DataReader. In this scenario the common thing is to first call the operation get_datareaders on the Subscriber so that DDS can return the list of DataReaders in the proper order to ensure the ordered access.

Does your situation match any of the above? If not I would need to think more to see if there are any other cases that could result on calling the on_data_available() and returning NO_DATA to the read/take.

Gerardo

 

Offline
Last seen: 1 year 8 months ago
Joined: 04/28/2013
Posts: 38

Would that be the case if I have NOT_READ_SAMPLE_STATE mask?

Gerardo Pardo's picture
Offline
Last seen: 2 weeks 5 days ago
Joined: 06/02/2010
Posts: 589

I would not expect that to happen if you are only using the NOT_READ_SAMPLE_STATE mask because this flag selects the samples that have not been read by anyone and presumably your listener is the only one reading the samples...

Is it possible for you to post here a simple reproducer? If so this could help us track down this seemingly odd behavior.

Gerardo