1

A couple of days ago I noticed that I no longer receive WhatsApp messages until I manually start the app, which is when the pending messages get delivered all at once.

I started my investigation by monitoring the com.whatsapp.messaging.MessageService in the Application Manager.

Here's what it looks like at first, after I exit WhatsApp:

enter image description here

And here's what it looks like a few minutes later:

enter image description here

It looks like the MessageService either quit, or it was terminated. To verify this, I checked with adb. I can see the service at first:

$ adb shell dumpsys activity services | grep wh
  * ServiceRecord{43deec28 u0 com.whatsapp/.messaging.MessageService}
    intent={act=com.whatsapp.messaging.MessageService.START cmp=com.whatsapp/.messaging.MessageService}
    packageName=com.whatsapp
    processName=com.whatsapp
    baseDir=/data/app/com.whatsapp-1.apk
    dataDir=/data/data/com.whatsapp
    app=ProcessRecord{42d19f90 10037:com.whatsapp/u0a10187}

But then this service disappears, even though the main process is still running:

$ adb shell ps | grep wh
u0_a187   10037 215   988084 78996 ffffffff 00000000 S com.whatsapp

The service does not get terminated at the same time. I have seen it killed as early as 6 minutes after exiting WhatsApp, and as late at 11 minutes. But in the vast majority of cases, it is terminated some time on the 8th minute.

I have carefully examined the logcat during the moment of service termination with the following logcat query, which I believe silences only the stuff I don't care about:

adb logcat -v time LightSensor:s LightsService:s  SensorService:s SensorManager:s STATUSBAR-BatteryController:s BatteryService:s HeadsetStateMachine:s android.widget.GridLayout:s MP-Decision:s SignalStrength:s McClient:s McDaemon:s QcrilMsgTunnelSocket:s | grep -v ss_tz_mobicore | grep -v ss_daemon

I was not able to see anything in the logs that would hint at what happened to the service. Did it quit? Did something kill it? How can I find out?

I thought that maybe the service was terminated b/c the OS was low on RAM, but this does not appear to be so. Here's the RAM at the moment of termination:

$ adb shell free -m
             total         used         free       shared      buffers
Mem:          1821         1587          234            0           75
-/+ buffers:               1511          310
Swap:          399          134          265

While working on this issue, I have used Titanium Backup to freeze all apps that might interfere with normal operation of WhatsApp, so these are the apps I froze:

  • Greenify
  • Amplify
  • XPrivacy

I also turned off "Per App Hacking", which is an Xposed Module.

Any ideas on how I can learn more about why MessageService is being terminated?

EDIT 1: Is it possible that MessageService is supposed to get terminated, and that WhatsApp relies on GCM to be notified when there are new messages?

0

I've been having exactly the same issue as yours. I can also see that the MessageService service is being killed after around 10 minutes. After the service is killed, messages are only received when opening the app. While googling today for this problem, coincidentally found this thread which you had posted just 3 hours ago.

I'm using a new phone on which I installed Cyanogenmod 13. I've already tried to change several settings related to battery usage, memory optimization etc., but to no avail.

I've started using this phone 2 days ago and the whatsapp issue has been happening since then. Tomorrow I'll try to uninstall and reinstall whatsapp from the Play Store, since this one was restored from a Titanium Backup backup. I saw in a forum someone who resolved a similar issue by doing that... he also had restored from a TiBu backup and was having such problem.

By the way, your theory about GCM seems to point to the right direction - in my wife's phone the MessageService service is also killed after around 10 minutes, however, she doesn't have any delays in receiving whatsapp messages - so maybe it indeed relies on GCM for that.

Let me know if you make any progress on the investigation or come to a solution. Let me also know if I can help you with anything else.

  • 1
    This doesn't answer the original question. – sickgemini Sep 29 '16 at 5:35
  • @sickgemini: Although it doesn't answer the question, knowing that MessageService is also stopped after 10 minutes on a working phone is very valuable to me. It tells me that the service is stopped by design, rather than being terminated by the OS. I am removing the downvote. – Val Blant Sep 29 '16 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.