status-mobile icon indicating copy to clipboard operation
status-mobile copied to clipboard

Status app using a lot of CPU in the background

Open DiGitHubCap opened this issue 4 years ago • 10 comments

Bug Report

Problem

status_cpu_battery

The Status app seems to be using a lot of CPU time in the background, more than any other app on my phone by far. I hadn't opened it all day, nor had I received any messages, so this is somewhat unexpected. My battery life has also been much worse ever since I installed Status.

Expected behavior

Status should not use very much CPU in the background when nothing is happening.

Actual behavior

Status is doing something in the background when the app is not open and no messages are being received that uses a lot of CPU and reduces battery life.

Reproduction

  • Install Status and run Status on Android
  • Use an app like BetterBatteryStats to check how much CPU it is using
  • Observe high background CPU usage with no activity

Additional Information

  • Status version: 1.12.1 (F-Droid)
  • Operating System: Android 9 (LineageOS 16)

DiGitHubCap avatar Apr 30 '21 20:04 DiGitHubCap

Default settings?

Use status nodes - on Sync using mobile data - on

?

I have both off fwiw, notifications on. 1% of total battery usage over the past 24 hrs

nahuhh avatar May 05 '21 15:05 nahuhh

Yes, default settings. Though I do have it syncing with 1 other device (my desktop). Use mobile data is set to off, though this doesn't really matter in my case since I don't have a data plan and only ever use Wi-Fi.

Use Status nodes is set to enabled. Does this have much of an impact on battery life? I assumed this would only matter when you start Status and fetch old messages. In any case, I don't want to lose messages that were sent when my phone was off or not connected to Wi-Fi.

Also, I don't think that the built-in Android battery usage estimate is very accurate in this case. Android usually claims that Status only used 3% battery or so after a day, but the real impact seems to be much larger, as shown by BetterBatteryStats and the huge reduction in battery life after installing the app. I think most of the impact comes from preventing the device from entering Deep Sleep. I didn't take a screenshot of this before, but BetterBatteryStats also records the percentage of time spent in different CPU states. The time spent in Deep Sleep as opposed to 650Mhz or 1Ghz seemed to greatly decrease after I installed Status.

DiGitHubCap avatar May 05 '21 15:05 DiGitHubCap

I don't have the betterbatterystats app but I have status installed on 2 devices, with with nodes disabled and notifications enabled.

I turned off one device, sent a bunch of messages from the other.

All messages came through when I turned it back on.

Perhaps status nodes are only NECESSARY for public chats? And the drawback for not using in 1:1 is a privacy one (lack of delivery receipts when sending to offline users allows sender to know recipients device is off or out of service.. Or something like that. I don't use nodes so I don't know the exact behavior)

nahuhh avatar May 05 '21 16:05 nahuhh

That's interesting. I'll have to try disabling Status nodes and seeing if I can still receive messages sent while I'm offline, and observe what impact it has on battery life, if any. Even so, I still don't think Status should be using so much CPU in the background.

DiGitHubCap avatar May 05 '21 19:05 DiGitHubCap

Agreed. But if battery usage ia normal after disabling, at least you'll know where the issue is

nahuhh avatar May 05 '21 19:05 nahuhh

Unfortunately, disabling Status nodes didn't seem to help at all. What's worse, I did not receive messages that were sent while I was offline, so I reenabled nodes as soon as I confirmed that there did not seem to be any impact on CPU usage or battery life.

DiGitHubCap avatar May 05 '21 23:05 DiGitHubCap

it depends on how many chats do you have and how active they are, so if there are lots of incoming messages while the app in the background it still needs to decrypt all messages, and that's why CPU is used

flexsurfer avatar May 18 '21 13:05 flexsurfer

As I said in the OP, I hadn't received any messages at all that day. I only have 3 chats open right now, and I receive relatively few messages normally.

DiGitHubCap avatar May 18 '21 13:05 DiGitHubCap

@DiGitHubCap how's the battery usage if you are offline/airplane node?

As I said in the OP, I hadn't received any messages at all that day. I only have 3 chats open right now, and I receive relatively few messages normally

You might still be receiving messages though in the background, as waku is a gossip protocol and it will receive and try to decrypt any message that matches the topics you are listening (which is based on your pk and not unique). What is possible is that you ended up in a high traffic topic based on your public key, if you could let us know (privately of course) your pk we might be able to check whether that's the case.

But knowing if the CPU/Battery usage is still high when you are offline would be very useful, that would rule out receiving messages as a potential source of the issue. Thank you

cammellos avatar May 18 '21 19:05 cammellos

@DiGitHubCap is that still the case for you?

churik avatar Jul 27 '22 14:07 churik

closing due to inactivity

churik avatar Dec 05 '22 17:12 churik