signalapp / Signal-Android

A private messenger for Android.
https://signal.org
GNU Affero General Public License v3.0
25.72k stars 6.17k forks source link

Abnormally high CPU usage in org.thoughtcrime.securesms::network_thread during audio/video calls #11067

Open shadeMe opened 3 years ago

shadeMe commented 3 years ago

Bug description

Even since I switch to Signal several weeks ago, I'd been noticing that the app uses an abnormal amount of battery during video and audio calls: Compared to other messenger apps such as WhatsApp and Telegram, I was seeing no less than twice as much battery usage. This happens on both WiFi and LTE. Turning on the toggle to reduce data usage seems to have no effect on this, with the CPU/battery usage no different from when it's off.

So, I decided to perform a system trace to see if there was something discernible in the logs. During an hour-long audio call, I recorded a ~75 second trace and inspected it one Perfetto. In the screenshot attached below, it seems that the network worker thread is using far more CPU time than any of the other threads in the app, in fact, an order of magnitude more time than the next busy thread (AudioEncoder). I'm not an Android developer, and I might be using the trace analyser incorrectly, but it seems rather suspicious that the network thread is doing more work than the audio encoder in this case.

Another thing that stood out to me was the /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64 process. I do not understand why this service should be using any non-negligible amount of CPU time, as this was an audio call. I was also speaking through a wired headset, so the on-device microphones should not have been active anyway. This is less likely to be connected to the above issue though, given the amount of CPU time it uses (could be a vendor-specific thing).

It would be really helpful if one of the developers could help me look into to this. It's currently a deal-breaker for me with respect to using the app and the service as a daily-driver. I'm willing to run additional traces, debugging measures, etc., and can provide the above trace file upon request.

Steps to reproduce

Actual result: Phone consumes a "reasonable" amount of battery for the duration of the call. Expected result: Phone consumes an "unreasonable" amount of battery for the duration of the call.

Screenshots

signal trace

Device info

Device: ASUS Zenfone 6 Android version: 11.0.0 Signal version: 5.4.7

Link to debug log

https://debuglogs.org/ffe43d450072887744bdbc466c50450384d7c36266b755381a0e43dc7d5650bb

(The relevant messages should be at the final quarter of the above log file)

williamspacefire commented 3 years ago

I confirm this, when i'm using voice call and need to charge my phone while in call, when it reach 70% charged my phone starts charge really slow like 100mA or less, this only happens with Signal, when i use WhatsApp or Telegram my phone charge normaly.

The only thing stopping me from drop WhatsApp for good is this and the call bug that my phone don't ring when receiving a call, it's really annoying, i use to spend hours in voice and video calls, hope this get fixed soon.

Device info

Device: Redmi Note 7 (lavender) Android version: 11 Custom ROM: Evolution X 5.5 Tremor Official Kernel: 4.4.252-Predator-Stormbreaker-X4.3-gb96cc7459 Signal version: 5.4.12

Link to debug log

https://debuglogs.org/6e787aa637588c71ee76cc6aa3463d613e2a2241ae50155e7abfea5d8a6f636d

Cyanne commented 3 years ago

During calls my battery drops quickly and my phone heats up a lot. I think this explains it...

cody-signal commented 3 years ago

Thanks for the details report, I'm going to sync up with our calling folks and see if we can learn anything new with your information.

ohimu commented 3 years ago

Probably this is the reason my phone was overheating. I filed my bug report at #11294 , should mark as duplicate.

shadeMe commented 3 years ago

@cody-signal Any progress on this? I'm currently on Signal v5.9.7 and am still experiencing the same issue.

major-mayer commented 3 years ago

Same here! During my one hour (audio only) call signal used a whopping 20% of my battery. Even though the POCO F3 should have one of the fastest processors out there it got really warm, just like when I'm in a graphically intense game.

cody-signal commented 3 years ago

Hey folks, sorry no update on this yet. It's something we're aware of and want to fix.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

ghost commented 2 years ago

That is indeed a good question, stalebot. What can we do to help? I'm no android dev and the last time this happened, there was even a patch and that still took an entire year to get merged. I had to run somebody else's patched build of signal.

This is definitely still an issue and I've already shared debuglogs. What elese is there to do?

underling3311 commented 2 years ago

Check this post just updated it again. https://github.com/signalapp/Signal-Android/issues/9798

If I am missing any phones in the list please let me know.

ghost commented 2 years ago

How does one find out how much CPU signal is using and due to which function? Is easy "install this app and wait" or more involved "enable dev tools, setup adb, execute, yadayadayada". I'm not an android dev, so instead of trying to cobble all this information together, it'd be nice to just have a simple guide.

feschber commented 2 years ago

I have the same issue. Pixel 6 pro android 12 - gets extremely hot on calls and drains the battery like nothing else.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

shadeMe commented 2 years ago

Keeping this open as I continue to have the same issue with the latest Signal Android app (5.37.4).

ghost commented 2 years ago

Same, on my Nexus 5X

christophra commented 2 years ago

Just to keep it open: Sony Xperia 10, plugged into charger, a video call drains the battery faster than it can be charged. I'll add a debug log later.

secretmango commented 1 year ago

I can still confirm that videocalls suck up a looot of energy and the display gets hot. Signal is the most power-consuming app I run, more than Libretube (HTTPS stream from a libretube instance).

Using latest self-updating APK on GrapheneOS (Android 13 based)