qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Pocock <dan...@pocock.pro>
Subject qpid-proton C++ on_sendable race condition
Date Tue, 27 Jun 2017 10:00:20 GMT


reSIProcate has a class QpidProtonThread[1] for sending to a topic.

The class runs the container in a thread, the method
QpidProtonThread::thread() is the code executed in the thread when it
starts.

Another thread is calling the sendMessage(..) method.  That method uses
event_loop()->inject(...) to have the doSend(...) method called safely.
This appears to work for a while.

I notice that when the event loop calls my void_function0 class
operator(), which calls doSend(...), it is not calling it in the
container thread, it is being called in the thread that invoked
sendMessage(...).  Is that expected behaviour?

Eventually, the on_sendable() method is called.  I see it is being
called in the container's thread.  That method also calls doSend(...).
At this point, the other thread becomes stuck.

I was thinking about simply removing the on_sendable() method.  However,
given that I am using the inject method, should I not be having a
problem like this at all?

Regards,

Daniel


1.
https://github.com/resiprocate/resiprocate/blob/master/repro/QpidProtonThread.cxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message