Signal-android: Version 4.59.6 not starting background sync service with microG (GCM disabled)

Created on 2 May 2020  Â·  39Comments  Â·  Source: signalapp/Signal-Android


Bug description

After the 4.59.6 update, the background sync service that is used when Play Services isn't present fails to start reliably. When the app is first installed, the normal "Optimize for missing Play Services" prompt is given, which is fine. But the background service notification does not show up until some ~30 minutes after app startup. After rebooting the phone, the service does not start up at all.

This is occurring on microG without GCM/FCM integration turned on. My suspicion is that the recent commit eea7174f1de6a6d8a2e67dfd788524189b71f51c caused this. The way it checks for presence of Play Services is different than the way Signal decides whether or not to use the backgound sync service during initial setup.

Once Signal has decided that Play Services exists, it tries to register to Firebase over and over, which of course fails...

Steps to reproduce (upgrade)

  • Upgrade from previous version to Signal 4.59.6 on a device without Play Services.
  • Phone number becomes unregistered.
  • After re-registering, background sync service does not start reliably or at all.

Steps to reproduce (fresh installation + backup restoration)

  • Install Signal 4.59.6 on a device without Play Services.
  • Accept turning off battery optimizations.
  • Use the app.
  • Background sync service starts after ~30 minutes.
  • After reboot, it refuses to start the background sync service at all.

Actual result: Background sync connection does not start, or only starts after some time (and operates unreliably, seemingly). Messages don't come until opening the app when the background sync service is not running.
Expected result: Background sync service starts immediately, showing the notification that a background connection is enabled. Messages arrive in real time.

Other Info: I took the debug log after a phone reboot. It seems to be trying to initialize the Firebase messaging service (it fails to get a token of course). I don't know if it normally tries to do this when it should be using the background sync service, but I find it odd that it attempts to use FCM in this case. More importantly, the entries of gcm disabled in the log start as false, then eventually go to true (when sync service is running), then back to false (after reboot).

Device info


Device: OnePlus 6 A6003
Android version: Android 10 OmniROM microG (11, QQ2A.200405.005 release-keys)
Signal version: 4.59.6

Link to debug log

https://debuglogs.org/3c613b05b463aa698b2adcbb9d79c96f5f9ddbd327726db84e7afa82eddf2698

Most helpful comment

Yeah, so I reverted the commit that caused the fake-play-services issue. It's worth noting that this is not self-healing -- running the new build won't magically fix you if your FCM stuff got screwed up. It should work just as before if you go through registration again.

I'll keep thinking of better ways to handle this in the future.

Edit: This fix is in 4.60.0, which is rolling out to beta now.

All 39 comments

+1
I also experienced this after updating to the most recent version. Additionally, my number was unregistered from Signal without me doing anything.

@cubagithub The Signal team needs more info to properly work on it - please include a debug log in your post. Here is how to get one in the app: https://support.signal.org/hc/en-us/articles/360007318591-Debug-Logs-and-Crash-Reports#android_debug

Android version: 10 (2020.02.11.10, QQ1A.200205.002.2020.02.11.10)
Signal version: 4.59.6
Locale: en_US
Debug Log: https://debuglogs.org/332f716a5a7f76598dc11aa9a9b3dc72a642d1beb261f854fd5edf41735965ae

+1
I also experienced this after updating to the most recent version. Additionally, my number was unregistered from Signal without me doing anything.

The number unregistering happened to me as well. I will update the original bug report.

So after digging through the code a bit, I think I have found the commit that causes this, and it might be something specific to MicroG. The (very recent) commit below checks if FCM/GCM is available when the app starts, but it does so in a different way than the way it's checked during initial setup.

commit eea7174f1de6a6d8a2e67dfd788524189b71f51c
Date:   Wed Apr 22 19:32:40 2020 -0400

    Check to see if FCM is available at app launch.

This commit checks for Play Services availability during startup by calling a Play Services API, which MicroG presumably implements, and returns true. But during initial setup, use of the background sync service is determined by whether or not the app was able to register with Firebase Cloud Messaging, which MicroG does not implement unless you specifically turn it on.

@cubagithub are you using MicroG on your device?

This log message (added with the above commit) appears in both debug logs:

ApplicationContext: Play Services are newly-available. Updating to use FCM.

@cubagithub are you using MicroG on your device?

I am using MicroG with all Google integration off and battery optimizations disabled for Signal.
When I had to reregister my number, I didn't get any prompts for optimizing settings.

That is exactly my situation. I will update the bug report accordingly.

I have the same issue since signal 4.59.6, with oneplus 5 with lineageOS 16.0-20200502-microG-cheeseburger. MicroG is intalled but GCM is disable.
Here a log report : https://debuglogs.org/e87f7020742df01da1bb05dddadf1f71fbd53857151324e447f2c51ba43494a5

Fun fact (or not) : since 4.59.6 I did't have my draining battery issue (https://github.com/signalapp/Signal-Android/issues/8658)

I am running LineageOS with microG (GCM disabled) and I am experiencing the exact same issues:

  • Non-requested de-registration from Signal (I could re-register without any issues)
  • Messages will not come through unless I open the app
  • Background sync service does not start and is not displayed in the notification bar

I believe my issues began with 4.59.7 or 4.59.8 (I may have missed one or two prior updates).

Please let me know if I can provide any additional information.

Not going to repeat what already been said, but I'd like to provide another bug report, in case it helps to have a few from different devices:
(Xiaomi RN7 / LOS-17.1 / microG with GCM and device registration disabled)

https://debuglogs.org/dd3fc270c89b7726f302d05db42220fb844a43e3604731e6a91a923034ae6b4e

I have the same issue, but would like to include my log, because I'm still on Lineage 16 (Android 9.0) and the line

ApplicationContext: Play Services are newly-available. Updating to use FCM.

doesn't appear in my log. (Neither does it in the log of @ronidee )
https://debuglogs.org/f883640f3aadf47c1559cb68a3d8f184ca64f02328d8c745b29dabf0cc73c31d

The commit was introduced because of #8992
I posted my log&analysis and a possible solution there...

If this is right:

This commit checks for Play Services availability during startup by calling a Play Services API, which MicroG presumably implements, and returns true. But during initial setup, use of the background sync service is determined by whether or not the app was able to register with Firebase Cloud Messaging, which MicroG does not implement unless you specifically turn it on.

this would be another solution.

A more proper way to determine whether or not to use the websocket service would probably be to rely on the result of being able to connect to Firebase Cloud Messaging, rather than directly asking if Play Services is available. This is how it works during initial setup, so I don't really know why it wouldn't work here as well.

No idea if that's a surprise for anyone who is familiar with the code, so I thought I'd drop a line:
Right now (after making a video call with signal, not sure if it's related) I see the "background connection enabled" notification again but it isn't working, meaning I don't receive messages until i open the app.

I also have this same bevaiour as of a few versions now (can't be specific about which version update caused it to start). I am running LineageOS with microG. No background notifications coming through. I also had a forced re-registration of my number about a week ago after an update.

I just found that thread… I'm currently with version 4.59.9 and I also have all the symptoms (registering again, no notifications unless I "use" my phone) — Lineage 15.1 / Android 8.1.
My 2 cents: maybe, instead of trying to guess whether FCM is available, an (advanced) option could be a good workaround: a user who uses microG should be knowledgeable enough to find this option!

I am running LineageOS with microG (GCM disabled) and I am experiencing the exact same issues:

* Non-requested de-registration from Signal (I could re-register without any issues)

* Messages will not come through unless I open the app

* Background sync service does not start and is not displayed in the notification bar

Exact same issue as above, not sure my previous version, but this occurred with 4.59.9

I'm running Lineage OS Nougat with latest security update, latest microG with GCM disabled.

Hope we can get a fix soon, thanks

(Update to the above i reverted to 4.58.5 and problem's gone, though i didn't test any versions in between so can't say for sure exactly when it was introduced.)

Same issues on LineageOS 16 / microG (pioneer). I had GCM enabled, when the issue first occured, it remains after disabling GCM. I think it first occured with 4.59.8, but cannot be completly sure, as I may have skipped some versions.

@greyson-signal @ProjectMoon I can confirm that the latest version (4.59.10) fixes this issue.

(I had to register my phone number once again, but this time I received the SMS and didn't have to use the calling service.)

Thank you very much! :-)

@greyson-signal @ProjectMoon I can confirm that the latest version (4.59.10) fixes this issue.

I can confirm that it works. Thank you!

But note that directly after the update it seemed not to work for me. So for anyone also experiencing this: Completely uninstalling and then reinstalling signal solved the issue.
Note also that you have to test it with an incoming message as one of the last updates removed the ever-present "Background-service enabled" notification.

Working again here with 4.59.10, thanks for the fix.
For me, the "Background-service enabled" notification is back.

Note also that you have to test it with an incoming message as one of the last updates removed the ever-present "Background-service enabled" notification.

By "fixes this issue" I meant this exact issue (#9578).
Meaning the background-notification. Was this update supposed to fix something else too? As your wording "also" suggests?

Hello,
just tested the latest version and I still face the problem. :(
No notifications on secured sms. (but on non secured sms, it's ok)

I finaly installed Langis for a workaround.

Meaning the background-notification. Was this update supposed to fix something else too? As your wording "also" suggests?

Sorry, that was confusing of me:
The behaviour on my device after the new update is the following:
When someone writes a Signal message to me, my phone notifies me of it regardless of signal being active or not.
But I do not see a persistent "Background-service enabled" notification anymore, meaning signal somehow can now check for messages in the background without the notification showing.

I hope that clears up what I meant.

  • Edit -
    After some additional investigation as prompted by observations from @ProjectMoon it appears that the issue is not fully resolved. While a reinstallation of Signal causes the app to behave as expected, after rebooting, messages and calls do not arrive unless Signal is manually opened. See below for a detailed write-up.

  • Original -
    @greyson-signal - I also just wanted to add my thanks. Everything is working smoothly again. Thank you. Signal is a foundational part of my daily workflow. Your work, and the work of the entire Signal team, is GREATLY appreciated!

@eike-fokken - Thank you for the update about Signal no longer displaying a permanent notification. Without your heads-up it would have taken me a fair while longer to confirm that everything is working again.

Given that the latest update was a library bump, I would say maybe more extensive testing is required. Does it survive a reboot, for example?

Edit: initial testing seems okay. Notification showed up after a reboot. Will spend some more time testing today.

Edit 2: after a second reboot, the notification no longer appears and messages don't arrive until the app is opened.

Given that the latest update was a library bump, I would say maybe more extensive testing is required. Does it survive a reboot, for example?

Apparently you are right: For me rebooting makes the background message reappear. But unfortunately it breaks the background service.

Completely uninstalling and reinstalling fixed this, not sure if anything else would have worked, force stopping didn't help.

Here is a fresh debug log
https://debuglogs.org/6588d0eb32aa39027432a31b3bf8195047177c4abe6b52a22b6237fffc62992d

From after reinstalling.

And

https://debuglogs.org/94d564be6628a29d637af23c9748a3480d69715ad026343359ec20e096847743

From after rebooting

@ProjectMoon, after more testing I can confirm the same behaviours. In summary:

1) If Signal is uninstalled/reinstalled then the messages and calls arrive, even through the phone does not display a Signal running in the notification section.
2) After a single reboot Signal is displayed in the notification section, but does not receive messages or calls.
3) After a second boot Signal is not displayed in the notification section and does not receive messages or calls.

If you uninstall (or clear app cache - equivalent of reinstall) and reactivate Signal, everything works as expected until the first reboot.

@greyson-signal, the recent changes you made in 4.59.10 have almost solved the problem. As @eike-fokken has already provided new debuglogs, I will not duplicate his effort. However if these would be helpful, please just ask and I will attach them.

Thank you to everyone who is working to resolve this issue.

It would seem there is now a new version .60 which actually has a revert of the commit that caused this. Time to test again!

Yeah, so I reverted the commit that caused the fake-play-services issue. It's worth noting that this is not self-healing -- running the new build won't magically fix you if your FCM stuff got screwed up. It should work just as before if you go through registration again.

I'll keep thinking of better ways to handle this in the future.

Edit: This fix is in 4.60.0, which is rolling out to beta now.

@greyson-signal - Thank you once again. I'll wait for 4.60.0 and report back.

If you planned on just using version 4.59.10 and not rebooting like me: Apparently something broke the background service without rebooting. My best guess is that reentering the pin for memorization was the culprit and somehow started the background message and cut off the actual background service.
Here is another debuglog:
https://debuglogs.org/16f252dc758f2f355909fe34bb68dd99098e4d99c86a4add6434b0d52f4d44f8

I guess such bugs could be found earlier if more microg users tested the beta versions. Therefore: Is there a way for me to join beta channel with aurorastore with anonymous profile?
Also: Can I simultaneously have beta and stable versions for signal? I don't have a spare phone for testing but would dislike to switch between versions when there actually is a bug in beta as then I have to also relink two computers.

The answer to both of those is no. You need to sign in to Aurora directly to get betas.

The answer to both of those is no. You need to sign in to Aurora directly to get betas.

A pity. Well for this one I used apkmirror.com which gave me a correctly signed signal version.

Yeah, so I reverted the commit that caused the fake-play-services issue. It's worth noting that this is not self-healing -- running the new build won't magically fix you if your FCM stuff got screwed up. It _should_ work just as before if you go through registration again.

I'll keep thinking of better ways to handle this in the future.

Edit: This fix is in 4.60.0, which is rolling out to beta now.

Fixed by uninstalling the app and reinstalling 4.59.10 fresh, then restoring my backup. I was prompted to optimize for background services upon install.

It would seem there is now a new version .60 which actually has a revert of the commit that caused this. Time to test again!

Everything works for me now. The message appears and the background service works as well, also after a reboot.
@greyson-signal : Thanks for your quick responses and of course your time!

Yeah, so I reverted the commit that caused the fake-play-services issue. It's worth noting that this is not self-healing -- running the new build won't magically fix you if your FCM stuff got screwed up. It _should_ work just as before if you go through registration again.

Could you please clearify what will fix the screwed up stuff if the Signal update doesn't?

Once you have 4.60, you will have to make a backup and reinstall the app.

Unless something has changed, you can also trigger re-registration by going into "Settings > Advanced" and switching "Signal messages and calls" off and back on

Was this page helpful?
0 / 5 - 0 ratings