qpid-proton mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Wynne <awy...@gmail.com>
Subject Messenger race condition on Android?
Date Fri, 17 Apr 2015 12:09:23 GMT
Sorry for the cross-post but I didn't get any hits on the user list and I now
think this could be a bug.

I think I am seeing a race condition with Messenger on Android only:

When I do the typical put/send sequence in a Thread started from an Android 
Activity, the message is not received by a subscribed peer.  If I kill the 
Activity, the peer will complain that the connection is broken.  So it 
seems that the connection is being made but the data is not sent.  Here is 
an example code snippet: 

    Messenger messenger = Messenger.Factory.create(); 
    // do other things like create a message 
    messenger.put(msg) 
   // Thread.sleep(200) 
    messenger.send() 

However when  I uncomment the sleep statement above, the message is 
received without any problem.   The message is also received if I attempt 
to debug to see what is happening in put(). 

I noticed that put() does not simply add the message to a queue, it also 
uses nio methods to do some encoding of the message.  I'm wondering if 
since it is not blocking, is there some encoding method happening while the 
send() is being processed, causing the message to be lost. 

We also noticed that there is a big CPU usage (up to 40%) spike during the
put/send process, which seems extreme for just a tcp send.



--
View this message in context: http://qpid.2158936.n2.nabble.com/Messenger-race-condition-on-Android-tp7623116.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.

Mime
View raw message