2

I created an architecture with a process A communicating to another process B through IPC.

A runs a sticky service. B runs a sticky service.

This A service binds to the B service.

When bind succeeds,

  • for requests from A to B, A creates :
mRequestMessenger = new Messenger(service); //service comes from onServiceConnected(..., IBinder service)
  • for answers from B to A, A creates :
//create the handler thread, start it
mResponseHandlerThread = new HandlerThread(mModuleName);
mResponseHandlerThread.start();
    
//Set thread as looper of ResponseHandler
mResponseHandler = new ResponseHandler(mResponseHandlerThread.getLooper()); //ResponseHandler is a Handler
    
//Set ResponseMessenger into messenger to receive callback
mResponseMessenger = new Messenger(mResponseHandler);

When A receives the responses from B, it is treated by first logging the received android.os.Message object instance. This message has the field "when" which shows the delay between message sent from B and message received in A.

For most of the cases, the value of when is around 0ms or -1ms (negative value due to computation : createdtime - now) For really rare cases, the messages seem stuck until something unlocks the situation.

Logs shows :

when=-1h49m55s146ms

when=-1h49m53s904ms

when=-1h49m54s502ms

.... until all "stuck" messages are well received.

Additionnally, when there are too many stuck messages, it seems that some of them are lost, with a limit of 875 messages.

I can't figure out what could explain this behavior.

EnzoMolion
  • 949
  • 8
  • 25
Seynorth
  • 686
  • 2
  • 8
  • 22

0 Answers0