Sending requests inside Reply callback - Request/Reply

2 posts / 0 new
Last post
Offline
Last seen: 8 years 2 months ago
Joined: 01/11/2016
Posts: 2
Sending requests inside Reply callback - Request/Reply

Greetings,

I have a problem with the following situation in RTI DDS Version 5.2.0, while using the Request/Reply API: For example, we have 3 participants, A, B and C. Participant A sends a request to participant B, and participant B, as part of the reply callback, sends a request to participant C.

The following exception occurs when waiting for replies for the request that participant B sends to participant C.

DDS.Retcode_Error: Failed to create a read condition
at RTI.Connext.RequestReply.Infrastructure.RelatedSequenceNumberConditionGenerator.CreateCorrelationCondition(DataReader reader, SampleStateKind stateKind, String indexName, SampleIdentity_t sampleIdentity)
at RTI.Connext.RequestReply.Infrastructure.SampleCorrelator`1.CreateCorrelationCondition(SampleStateKind stateKind, SampleIdentity_t relatedIdentity)
at RTI.Connext.RequestReply.Infrastructure.SampleCorrelator`1.WaitForReplies(Int32 minCount, Duration_t maxWait, SampleIdentity_t relatedIdentity)
at RTI.Connext.RequestReply.Requester`2.WaitForReplies(Int32 minCount, Duration_t maxWait, SampleIdentity_t relatedRequestId)

The DDS logs for this error state the following:

[D0001|Reader(80000504)|T=TopicBReply_AC17801800000B200000000180012003|CREATE READCONDITION]
DDS_DomainParticipantGlobals_is_operation_legalI:RTI0x20f0031:INTERNAL ERROR: illegal operation due to exclusive area problem. Cannot enter EA from level 20 to level 10

The repliers are using listeners, so they are notified whenever they receive a request.

As an additional note, all the requesters and repliers on all participants have been created prior to sending the requests. If I understood the problem correctly, I cannot send the request with the relatedRequestId without creating a read condition, and I cannot create a read condition inside the reply callback thread due to Exclusive Areas. Just to add that we must have the relatedRequestId, in order to be certain that the request is processing the correct reply.

I tried running async tasks inside the replier's callback in order to avoid running into the issue with Exclusive Areas. Then we ran into another problem. The call for the WaitForReplies on the requester for participant B blocks the call indefinitely. My understanding is that WaitForReplies uses the same thread that the replier on the same participant uses. And since that replier is waiting for the async task to end (so that it can get a return value), the WaitForReplies will never be completed.

We had the similar problem while sending requests inside subscriber callbacks, but we solved that by sending the request in another thread. That was ok since the subscriber callback did not return a value, while this is not acceptable for the replier, since we need a return value.

My question is, is there a workaround for this? Is there a way to send requests inside a reply's callback?

Kind regards,

Kosan

Offline
Last seen: 8 years 2 months ago
Joined: 01/11/2016
Posts: 2

Just to add that I've found a solution to the problem.

The solution is creating a new thread inside the replier listener for participant B that will take the requests, process them, and then respond to the requests from the new thread, which is not created by the DDS. That way, we avoid blocking the DDS replier thread, and issues with EA.