-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signal draining battery in background #6898
Comments
Same issue. On Nexus 6P running Android 8 Oreo. I haven't opened Signal all day, yet it's the second highest usage (only 4%) Battery Stats Page - https://i.imgur.com/4lgWYqP.png I also noticed 12% usage on Tuesday after a 10-15 minute text based chat with 1 person. |
Can both of you send debug logs and paste the link here please? |
I will post another at the end of the day it might be more useful than this short log but basically, I am seeing 21-30% drain on Android 8.0 Google Pixel so rather high-end hardware and a stable Android release. With Android 8.0 the OS has background limits so clearly Signal is ignoring those right now somehow. |
Doesn't look like Signal is doing anything. Are you running an official production update of Android 8 that you got through the device's update channel, or something that you flashed yourself? |
@moxie0 I am using an official OTA of Android 8.0 nothing custom here Signal is top user again today so far 8% of battery used for 3 minutes total in signal but shows 5 hours of background activity by signal New debug log: I am pretty sure signal will get to 20% by end of night like it has the last few nights |
Strange, must be a problem with Android 8. Nothing has changed in Signal, there should be no reason why it uses more battery in Android 8 than Android 7. There are no background tasks, that debug log only shows foreground activity. |
In android 8,it looks like apps that run in the background would have a notification about it. |
I wonder what it considers "running in the background." If Android 8 isn't killing them, Signal does have services that are "persistent," like the KeyCachingService, but that service doesn't run any instructions, it just caches a key in memory. |
Android 8 doesn't kill it because Signal doesn't target API 26.
I'm astonished you guys are still on API level 22.
…On Aug 27, 2017 10:49 PM, "Moxie Marlinspike" ***@***.***> wrote:
I wonder what it considers "running in the background." If Android 8 isn't
killing them, Signal does have services that are "persistent," like the
KeyCachingService, but that service doesn't run any instructions, it just
caches a key in memory.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6898 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0cJ0ljLJew79Di5ahCIfCIIw6AYn1Nks5sclTOgaJpZM4PDtvG>
.
|
@bkerensa This really doesn't have anything to do with target API levels. The changes made in Oreo are additive; to my knowledge nothing about Android Oreo should mean that applications which performed no background work in Android 7 now suddenly perform hours of no-op background work in Android 8 unless they're targeting API 26. There are many possibilities, including bugs in Android 8 that misreport battery consumption. To help fix this, though, I need someone who can reliably reproduce this issue on an Android 8 device to help identify what Signal is doing in the background. If you have the time and inclination to help, I would appreciate the investigation. |
Let me know what you need
…On Aug 28, 2017 9:39 AM, "Moxie Marlinspike" ***@***.***> wrote:
@bkerensa <https://github.com/bkerensa> This really doesn't have anything
to do with target API levels. The changes made in Oreo are additive; to my
knowledge nothing about Android Oreo should mean that applications which
performed no background work in Android 7 now suddenly perform hours of
no-op background work in Android 8 unless they're targeting API 26.
There are many possibilities, including bugs in Android 8 that misreport
battery consumption. To help fix this, though, I need someone who can
reliably reproduce this issue on an Android 8 device to help identify what
Signal is doing in the background. If you have the time and inclination to
help, I would appreciate the investigation.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6898 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0cJ2k7Kn6hcjVtTGnirFxWBjkNFtAhks5scu04gaJpZM4PDtvG>
.
|
@bkerensa I would need to know what Signal is doing in the background on your device. Can you take a look and see if it is actually running, and if it is actually running, how much CPU time it is using, and if it is non-idle, what work it is performing? |
Confirmed process is running non-stop https://imgur.com/a/mt2wy I tried on another device running 8.0 and was able to reproduce and can continue to confirm that Signal is the highest battery using app I have installed even more so than my social media apps which I spend a lot of time in and I spend very little time in Signal. |
@bkerensa Those are idle services, they shouldn't be executing any instructions. Could you check and see if Signal is actually doing any work? |
Is there specific tools or methods you'd like me to check for this with?
This is not a rooted device so relying on the system it does show one of
those processes running 100% of the time using memory and draining battery
specifically the MessageRetrieval process seems to be the culprit.
…On Aug 29, 2017 9:06 AM, "Moxie Marlinspike" ***@***.***> wrote:
@bkerensa <https://github.com/bkerensa> Those are idle services, they
shouldn't be executing any instructions. Could you check and see if Signal
is actually doing any work?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6898 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0cJ7K2CBCi1Vl8mBfX1IZCrw4Fe9_Jks5sdDcHgaJpZM4PDtvG>
.
|
@bkerensa You can use the thread profiler in Android Studio to see what that thread is doing. If it's in the background for more than 30 seconds, it should be completely idle waiting on this lock: |
Looks like these instructions are occurring spuriously throughout the day without the app being opened: |
I received the Android O update to my pixel xl last night. I can already confirm signal is using way more battery then it did on nougat. With my use patterns it would almost never show up in the battery stats. Now on Oreo my phone has been off the charger for 3 hours. Signal is already using 9% of my battery and is climbing. |
Does it just show up in the stats or do you actually notice an unusually high battery drain? |
@moxie0 Does that info work for you? As more and more people ramp up to Android 8.0 this is going to be a more widespread issue. I would guess you guys have thousands of users on 8.0 already suffering from this issue. I feel like until this is fixed I am put in the precarious situation of whether I want signal draining my phone or whether I want secure messaging. |
@haffenloher see above it is already confirmed in profiler in android studio and also spurious messages are in logcat about the signal process. Seems like WhisperSystems just needs to do some QA here but ultimately this issue would not be occuring if API Level 26 was targetted because Android 8.0's background limits would kill whatever is causing KeyCachingService to constantly run instructions. |
@bkerensa Nobody has used the thread profiler to show what battery-draining work Signal is ostensibly doing in the background. "The battery stats say Signal is using battery" doesn't answer that question, nor do the application logs. This leaves at least two possibilities: the services are causing measurable battery drain even while being idle (seems unlikely, but maybe possible), or Android's battery stats are overzealously calculating app-specific battery usage. But there is still not enough information to make a determination between these possibilities. In order to debug this, you or someone with access to a physical Android 8.0 device will need to use TraceView (I believe this is what Moxie is referring to but if not someone please correct me) to understand what exactly Signal is doing in the background. If you can follow that guide and post the complete results here, then Moxie will be able to further understand how to solve this issue. If you cannot, unfortunately there is not much you can do other than patiently wait for someone else to do this. Finally, OWS is a very small team. There is only one Android developer at the moment, and raising the targeted SDK level by 4 levels is a massive undertaking because of the code that needs to be written, tested, and debugged, among other things. Furthermore, it's generally unnecessary, because future Android versions try to play nicely with older apps. This issue is sadly an exception, but please realize that OWS is resource constrained, not lazy. |
@nrizzio That is not correct see comment above #6898 (comment) where in response to Moxie I used the profiler and pasted the instructions that are running constantly according to the profiler |
@haffenloher I haven't had a chance yet to go home and hook it up to Android studio. The best thing I can say is it looks like my phone isn't really sleeping. Also battery stats say signal has used 331 mAh which is 14%. Granted Oero has a new battery stats screen so maybe that's it. Also I agree it probably isn't the API level. Just changing it to 26 may not help. Oreo only denies background services to apps that Target 26. If the user hasn't manually set that in the settings for the signal app it should still be able to run in the background. |
@Tatoniss the default for all apps in 8.0 is optimized battery use so it will nuke constantly running processes as long as the SdkVersion is 26. Aside from Background Limitations, there are a variety of other benefits of not staying to an API level that is not even an official API level but a developer preview level not intended for production use. |
@bkerensa I'm not sure what you're referring to, that looks like logcat output rather than instructions, are you sure that you're looking at the right thing? That intent is fired from exactly one place in the entire codebase, the onResume() method of PassphraseRequiredActionBarActivity. It is used for the KeyCachingService to track "active use" for timing out a passphrase, but it would be very strange indeed if the onResume() method of an activity were being called without the app ever being launched? |
@bkerensa
Can you confirm that you have disabled background activity toggle of the app? Apps -> App Info -> Signal -> Background activity
For futher investigation, you can also generate a bugreport and analysis it by yourselves with the help of battery historian V2 which is a docker container project by google: |
Same here. Per Android's calculations, Signal has used 41% of available energy at the time I had to recharge. Nexus 5X, Android 8.0.0 |
Per default this is enabled for Signal. I've disabled it now and will report if something changes noticeably. |
@johnmela If you're seeing battery drain on a stock device with play services, it'd be great if you could profile the application to see what work it's doing when it should be idle. Otherwise I would need steps to be able reproduce the issue you're seeing on a device of my own. There's nothing at all abnormal in that log. |
@moxie0 I just uninstalled it.. which removed the state the app was in 🤕 . I'll grab the source, profile it for a bit and see if I can reproduce |
It has taken a while but the issue seems to have resurfaced. Hopefully this information is useful, I am not sure what specifically would cause a problem. I removed the device off of the charger this morning. Used snapchat, messages, chrome a little but but hadn't interacted with the signal app at all. Signal appears to be using significantly more energy than any other app. Here are a couple log cats from this morning. And a screenshot from the profiler. I have noticed JIT thread pool active for 12 minutes, finalizer daemon active for 12 minutes and count and also the JVMTI Agent thread doing the same, neither concurrently running If there is anything else I can do to assist, please let me know |
@johnmela Thanks for looking into this. The logs look normal, just looks like you did one key rotation, received an SMS or two, and that's it. I'm afraid I can't do much with that photo of the profiler. If there's activity happening, can you look and see what it is? For instance, last time I was able to determine that some timer animations were continuing to run after the app had been backgrounded. Can you see what's happening in your case? |
Hey @moxie0, I'd love to help more, unfortunately, I'm not sure where to start here. It's been a few years since i've touched any native Android projects. Where should I be looking for this.. and can I see this within the profiler? EDIT: If you mean UI activities running while the app is in the background.. no I didn't see that but I can remain vigilant, I only noticed the running threads |
@johnmela Yeah when your app is in a state that you feel is consuming power, you can open up Android Device Monitor (Tools -> Android -> Android Device Monitor) from Android Studio. Then select the process in a connected device, and click the button in the toolbar above it with the tooltip "Start method profiling." Wait 20 seconds or so, then "Stop method profiling" (same button). There should appear on the right a sorted list of where Signal is spending its time, and you can scroll down until you start hitting some Signal (non-framework) methods. |
Out of curiosity as the developer why are you not investing time in doing
QA to resolve issues like this? This bug has been open for weeks and you
have not tried to reproduce it? Do you not have a single device running
Android O?
…On Thu, Oct 19, 2017 at 5:01 PM, Moxie Marlinspike ***@***.*** > wrote:
@johnmela <https://github.com/johnmela> Yeah when your app is in a state
that you feel is consuming power, you can open up Android Device Monitor
(Tools -> Android -> Android Device Monitor) from Android Studio. Then
select the process in a connected device, and click the button in the
toolbar above it with the tooltip "Start method profiling." Wait 20 seconds
or so, then "Stop method profiling" (same button). There should appear on
the right a sorted list of where Signal is spending its time, and you can
scroll down until you start hitting some Signal (non-framework) methods.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6898 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA0cJx-jLZ_1wUVKuOEE1rd9-4wJhe6fks5st-LtgaJpZM4PDtvG>
.
--
Benjamin Kerensa
|
@bkerensa This is an open source software project. I am but one person, and there more than a thousand open issues. I do have an Android 8 device (bought it just for your issue!), and I have spent time trying to reproduce this report (I even made a change that fixed things for most of the commenters here), but I have been unable to reproduce the exact problem you are seeing. There are other people who can, though, and by helping they end up improving the software for themselves and for anyone else who is in the same situation. This is the magical dream of open source software, even if the reality more often bears a closer resemblance to the highly suggestive email you just sent me and ~600 other people. |
I'm having battery drain issues as well. Device: Google Pixel 12 minutes of signal/screen usage today and 18% battery showing up. I have very little programming experience (first time using github as well) but I'm happy to provide any info you think may be useful. I may need a bit of coaching (never used android studio either). A friend just got the same phone running the same signal version and is having the same issue. I can provide screenshots from my phone if required but they basically mirror what has already been posted. If I could get the profiler working I wouldn't know what to look for. Thank you for your time and patience. Edit: I might be jumping the gun a bit here but I believe the issue is somehow related to WiFi. I turned wifi off this morning and my phone is at 85% battery with 1% of that being Signal. I also experienced this a week ago when I was without wifi for a couple of days and was restricted to cellular data. I will continue the day without wifi and report back. I'll also turn wifi back on tomorrow and see what happens. Again, thanks for your time. Edit2: I don't believe wifi is connected to the issue any more. I've been getting some days with high signal usage (over 10% battery with ~9 minutes of use) and some days with low usage (3% battery with 20 minutes of use). I will keep trying to find patterns and report back. |
@moxie0, thank you for what you do! Everyone should focus on providing as much debugging/data as possible and if he has the time, he can get to it. Or others should try a pull request, I guarantee that he would appreciate the help. |
Echoing @tcables, thanks much. Found this thread when I noticed the same issue as others. Pixel XL on stock 8.0. I have Signal's background activity limited as per app settings, and have been using the desktop app today, not the phone. Signal still shows 30 mins of background time during the 5.5 hours I've been off a charger. Worth it, but not ideal. I haven't used Android tools in a long time, but I'll see if I can poke around and help track this thing down. |
Update: before I plugged in the tools, I R&Red the app. Didn't save messages, clean install. It basically fixed my battery issue (so far), although I did still need to discourage background activity thru the system setting. (Before I did that, Signal was taking a lot of background time, but with much less battery drain than before the reinstall.) It's been a few days, with light Signal usage from phone and from desktop. So i'm not that helpful but it's something. |
I have also massive battery drain on Android 8.0 pixel xl. Reported it here: #6732 This has been going on for ages for lots of people. |
I'm no longer having battery drain issues after updating to android 8.1. Can anyone else on 8.1 who was having issues on 8.0 confirm? |
Great! I have been thinking about doing a clean install for the 8.1. I'll reply here the results when I have done it. |
The latest version of signal and Android 8.1 has fixed the battery. Signal is no longer the main battery drainer. Granted I haven't been watching it lately so I watch it over the next few days and report back. |
@acc412 Experienced the issue with Android 8.0, is gone after update to 8.1 without any action from my side. |
Samsung S8 user here. My concern with this is that Samsung has been updating to the X.0 version of Android for awhile now and this might kick us where it counts when Oreo gets here for Samsung. |
I can confirm that Signal is no more draining battery on Android 8.1. |
I've been experiencing massive battery drain on signal. Feels like it has to do with signal calls. I thought maybe I was just imagining things but then I checked here and saw this issue. I'm running stock android on a google pixel. https://debuglogs.org/e89e19d93e458f0cce77f4702dcc592b7cc1577a9337328cb76ef053dad93b43 |
Same here. Signal is draining battery on Oreo 8.0. why is this report closed? |
I am curious why this was closed as well, I am having the same problem where signal drains more battery than any other app on Oreo 8.0. This thread is closed, but according to this thread the only "fix" for the problem is getting a device that uses android 8.1 or higher. |
Having this same problem on Android 9 - even got an Android message warning me that Signal is using a lot of my battery in the background |
Hello All, looks like for me the same issue. I haven't use signal for whole day and I could see singal as 2nd app in battery usage for that day (14%). Also I have noticed signal is consuming too much data on background - the same day I haven't opened signal for whole day it consumed 53MB. Looks a quite lot for me when haven't opened the app at all. Anyone else experiencing such a issue in Oct 2019? Thx. Y |
Mine's 58%! Device: Debug Log: Edit: Another thing I noticed is that I cannot turn Battery Opmitization on again: it simply won't let me. For other apps it's ok. For Android 7 and 8.1 with different ROMs I had, was running fine. On all of them I do not use Google Services or alternatives. |
Same issue with Signal 4.55.8 on my Nexus5X 1005mAh for 5h22min50s. |
I'm on 4.71.5 on my de-googled (no playstore) galaxy nexus (maguro) with lineage 14.1. Signal STILL uses around 30% battery. Which IS better than before (50-75%) but still unacceptable for a chat program. |
I have:
Bug description
Signal constantly running in background and using 21% of battery in Android 8.0 and ignoring Android 8.0 background limits
Steps to reproduce
Actual result: Describe here what happens after you run the steps above (i.e. the buggy behaviour)
Expected result: Describe here what should happen after you run the steps above (i.e. what would be the correct behaviour)
Screenshots
Device info
Device: Manufacturer Model XVI
Android version: 0.0.0
Signal version: 0.0.0
Link to debug log
The text was updated successfully, but these errors were encountered: