Skip to content
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

High battery consumption in v4.6.4 due to infinite loop in statistics calculation #5499

Closed
4 of 6 tasks
derKief opened this issue Nov 1, 2024 · 115 comments
Closed
4 of 6 tasks

Comments

@derKief
Copy link

derKief commented Nov 1, 2024

Please answer the following questions for yourself before submitting an issue

  • Filters were updated before reproducing an issue
  • I checked the knowledge base and found no answer
  • I checked to make sure that this issue has not already been filed

AdGuard version

v4.6.x

Environment

  • OS version: OneUI 6.1
  • Device: Samsung S24, Samsung A25

HTTPS filtering

  • yes, I do

Root access

  • yes, I have it

Integration with AdGuard VPN

  • yes, I do

Routing mode

Local VPN

Ad Blocking

AdGuard Base filter

Privacy

AdGuard Tracking Protection filter

Social

AdGuard Social Media filter

Annoyances

AdGuard Annoyances filter

Security

No response

Language-specific

AdGuard German filter

Other

AdGuard DNS filter

Which DNS server do you use?

Cloudflare DNS

DNS protocol

DNS-over-TLS

Custom DNS

No response

What Stealth Mode options do you have enabled?

No response

Issue Details

Steps to reproduce:

  1. Install v.4.6.x
  2. wait a llittle and check battery drain with battery tools like GSAM, Samsung Battery Tracker
  3. Adgaurd is top of the list

Expected Behavior

When updating to v4.6 i expect same behaviour as with v4.5

Actual Behavior

High battery drain

Screenshots

Screenshot 1

Additional Information

The initial ticket #5460 was closed even though the problem is not yet solved (at least not for everyone).
Since I can't reactivate the initial ticket or can't find how to do that, I'm opening a new one so that the topic isn't forgotten and lost!

Original text:
Since the first version 4.6 I have noticed an increase in battery consumption.
Even the newer versions do not solve this problem. Only a downgrade to v4.5 helps me.
On Reddit you can read about some people who have the same problem.
I have this with a Samsung Galaxy S24 and Samsung Galaxy A25

@derKief
Copy link
Author

derKief commented Nov 1, 2024

I installed the new stable version 4.6.4 on both my devices today but unfortunately I quickly realized that the problem with the high battery consumption has not been resolved. On the contrary, I even have the feeling that it has gotten worse. Furthermore, new problems have arisen.
One of the two devices suddenly started charging very slowly and it felt very sluggish. After the downgrade to version 4.5 everything is fine again and the problems listed no longer exist.

For now I have gone back again to version 4.5 on both devices.

@Versty and @artemiv4nov please remove the labels Status: Resolved and Resolution: Fixed because unfortunately the problem does not seem to be solved and Fixed.
@0xrxL also reported back that it is not resolved for him

@Versty
Copy link
Contributor

Versty commented Nov 2, 2024

@derKief We have double checked the battery consumption rates with 4.6.4 release version, battery usage is within the normal range of 1-10% on our devices.

Does AdGuard for Android 4.6.4 still consume more than 10% battery on your device?

On the contrary, I even have the feeling that it has gotten worse.

Please, describe in detail what behaviour of the application has caused you to think this way.

@derKief
Copy link
Author

derKief commented Nov 2, 2024

During my test phase, both Samsungs had between 15-20% battery consumption. With version 4.5, the consumption on both devices is max. 2%.

One Samsung had to deal with severe freezes during the test phase. I found the slow charging much worse. A 15W charger adapter only charged with 1-2 watts. Normally, this is around 10W.

The user @0xrxL also reports in the closed case/ticket/report that the new version did not help him. Users on Reddit also confirm that the new version does not help everyone.

@Versty
Copy link
Contributor

Versty commented Nov 2, 2024

@derKief 15-20% is more than expected. In order to find the cause, we need to take a look at detailed battery dump.
Could you provide a battery dump with AdGuard for Android 4.6.4 from one of your devices?

Please follow this steps:

  1. Fully charge your device

  2. Install AdGuard 4.6.4 to your device and wait for AdGuard's battery consumption hit more than 10%.

  3. Switch device to the developer mode. To do this: go to System settings -> About -> tap Build Number 7 times.

  4. Go to Developer Options in the system settings -> enable USB debugging

  5. Download Android SDK Platform Tools to your PC. Choose the appropriate download link for your OS from the Downloads section. Once you tap the link, a ZIP file will be downloaded. You can extract the ADB (Android Debug Bridge) files from the ZIP file and store them wherever you want.

  6. Connect the mobile device to your PC over USB cable.

  7. Test whether ADB is working properly: connect your Android device to your computer using a USB cable, open the Command Prompt, PowerShell or Terminal and run the following command: adb devices

If everything is set correctly, your device will be visible in the list of connected devices

Example

  1. Enter the command adb shell dumpsys batterystats --charged com.adguard.android > batterystats.txt to terminal

  2. Find the batterystats.txt file on your PC and sent it to [email protected], mention the [android] keyword and 5499 number in the email subject.

@0xrxL
Copy link

0xrxL commented Nov 2, 2024

4.7 Nightly 39
4.5 Stable

@muchqs
Copy link

muchqs commented Nov 3, 2024

Can confirm this behavior. On my Vivo X100 Pro, battery usage increased significantly after updating to v4.6.4. Battery usage info in Settings constantly show AdGuard always on top, before that this never happened. (yes i read the AdGuard FAQ saying it's not really accurate). But the biggest indication that it's AdGuard using battery, is the heat it is generating on my phone. Even after I cleared all apps, AdGuard service is somehow causing high CPU usage which then significantly heats up my phone to the point the CPU temp reaches 70C and phone is VERY warm to the touch. This also never happened before with previous version.

@derKief
Copy link
Author

derKief commented Nov 3, 2024

@Versty
Unfortunately, I can't do that at the moment because I've gone back to v4.5 on both devices and don't have time to experiment at the moment. I also need reliable devices.
If I find the time I will create a batterydump. Maybe someone else can help out here.

But as you can see from the comments, I'm not the only one who is still affected by this.

@arichiardi
Copy link

arichiardi commented Nov 3, 2024

Came here to say this. Noticed an increase in the latest version. Consumption is around 16% (did not use the phone in the attached 4 hours).

Screenshot_20241103_095022_Device care

Also noticed phone (Samsung S24) was warm.

Version 4.6.202.

@Gestrid
Copy link

Gestrid commented Nov 3, 2024

I'm on the latest stable update myself. AdGuard has used a whopping 27% since the last charge, and my phone has been running unusually hot. I'm using a Pixel 6 Pro running Android 15. It's running AdGuard v4.6.4.

Screenshot_20241103-131302

For most of the time in the picture above, my phone was idle. I wasn't using it, and it was just in my pocket.

@jordansworld
Copy link

i have high battery usage as well. almost 13% 💀
Screenshot_20241103_122829_Device care

@solkarnar
Copy link

Just popping in to say i have the same problem too. Have disabled the app for now. 4.6.4 did not fix the issue.

@MGS9500
Copy link

MGS9500 commented Nov 3, 2024

Same problem on Samsung Fold 6. Updated to 4.6.6 and battery drain stated on the Adguard App is 15%. The phone feels warm and visibly drains over 4 hours.

I have turned AdGuard off. This is a problem.

@three20three
Copy link

Also having the same issue on Galaxy S23.

Screenshot_20241103_171005_Device care

@TigerCraneStyle
Copy link

I agree with everyone else. I also had a bad experience using Adguard for Android while out today. 40% usage. I've never had any app use that much battery before since I've used smartphones.

Using v4.6.4 on a Pixel 9 Pro Fold.

Screenshot_20241103-144049

@Gestrid
Copy link

Gestrid commented Nov 3, 2024

I should add to my initial comment (seen above) and say that the issue for me actually seemed to only occur in v4.6.4. Either that or it exacerbated the issue to a degree that I only just started noticing it for the first time. I'm not sure which.

Either way, I've gone back to v4.6.3, and the issue has definitely gotten better for me.

@yochananmarqos
Copy link

What's ironic is the release notes for 4.6.4 claims it fixed a battery drain bug. I had no isssues with <= v4.6.4-beta-1.

@derKief
Copy link
Author

derKief commented Nov 4, 2024

In my case all started with the first v4.6 stable release.

@muchqs
Copy link

muchqs commented Nov 4, 2024

This v4.6.4 release is absolutely insane and should be PULLED ASAP. The high heat this release creates can possibly DAMAGE HARDWARE.

Here's what I posted earlier, it was early morning and I was too tired to post screenshots.

Can confirm this behavior. On my Vivo X100 Pro, battery usage increased significantly after updating to v4.6.4. Battery usage info in Settings constantly show AdGuard always on top, before that this never happened. (yes i read the AdGuard FAQ saying it's not really accurate). But the biggest indication that it's AdGuard using battery, is the heat it is generating on my phone. Even after I cleared all apps, AdGuard service is somehow causing high CPU usage which then significantly heats up my phone to the point the CPU temp reaches 70C and phone is VERY warm to the touch. This also never happened before with previous version.

But here are the screenshots now:

  1. It says Today's background usage: 1290 mAh. Battery is 5400, so 1290/5400*100 = 23.89% battery.
    https://i.imgur.com/NbTGr0Q.jpg

  2. But the biggest problem is this version PUTS CPU AT MAX and the cores NEVER downclock. You can see the temp graph is literally 100% ABOVE 60C with constant spikes going to 70C, while the core graphs shows most of the cores are AT 100% ALL THE TIME. These measurements are taken while the phone is IDLE.
    https://i.imgur.com/vlvuwjS.jpg

  3. @derKief mentioned in 2nd post they downgraded to v4.5. So I did that too and here is the temp graph. Also taken while phone is IDLE. Now the temp is NEVER in the red. See the temp graph it's never going above 40C while the cores downclock as normal.
    https://i.imgur.com/dgpK5pa.jpg

This issue needs to be put at the TOP of the priority list and this release needs to be pulled ASAP.

@0xrxL
Copy link

0xrxL commented Nov 4, 2024

It's insane how literally nobody (neither in AdGuard team) noticed this bug during the entire development of version 4.6.

And, in truth, also this is insane (compared to the last nightly)

Screenshot_20241104_011801_Device care

@muchqs
Copy link

muchqs commented Nov 4, 2024

I should add to my initial comment (seen above) and say that the issue for me actually seemed to only occur in v4.6.4. Either that or it exacerbated the issue to a degree that I only just started noticing it for the first time. I'm not sure which.

Either way, I've gone back to v4.6.3, and the issue has definitely gotten better for me.

It is definitely the second one. v4.6.4 exacerbated this issue big time. I noticed my phone getting warm for no reason a while back already, but I didn't know why or which app and never suspected AdGuard. I actually thought it was a system update that caused it. But this v4.6.4 release increased the heat so much and it started immediately after updating so I finally noticed it. Thinking back, I agree with the OP this issue most likely started with the first v4.6 release that's why I noticed phone was getting warm before but didn't know why. Then downgrading to v4.5 immediately solves the issue also kind proves issue started with v4.6

@artemiv4nov
Copy link
Contributor

artemiv4nov commented Nov 4, 2024

Hi all. Please collect debug logs and send them to [email protected] marking email with the number 5499.

@wrongway213
Copy link

wrongway213 commented Nov 4, 2024

Log sent via email above. Hoping for a quick resolution as this drain is currently unusable on S24U (tried latest release 4.6.4 as well as nightly 4.7 #40). As others stated it's likely a 4.6.x issue, but 4.6.4 is when it became game breaking. If anything else is needed please let us know!

@artemiv4nov
Copy link
Contributor

I found the cause of the bug. Unfortunately it's the same problem we wrote about in the notes, we didn't realize the bug would occur in other time zones.
I'll fix it today as soon as I get to the office, I need a volunteer to test in the Nightly version

@Guguloi
Copy link

Guguloi commented Nov 4, 2024

Mine looks fixed with 4.6.4.
New Pixel 8 Pro and big problems with 4.6.3. Tried nightly 4.7.39.and back to normal
Then tried 4.6.4 and looks fine too.
Screenshot_20241104-082114
Screenshot_20241104-082210

@louietyj
Copy link

louietyj commented Nov 4, 2024

Adding my data point here. Didn't notice any issues with 4.6.3. After upgrading to 4.6.4, woke up to a massively overheating phone. Battery drained 50% over 2 hours idle.

This can be reproed on a Pixel 9 Pro with a fresh uninstall + reinstall of Adguard (all settings reset to defaults + HTTPS filtering enabled). I closed all foreground apps, leaving Adguard running, and checked the battery drain rate in AIDA64.

  • On 4.6.3 (downgraded), averaging 100-200mA discharge rate on idle with screen on.
  • On 4.6.4, averaging 600mA-800mA discharge rate on idle with screen on. This is a huge difference.

@proximitea
Copy link

My OnePlus 12R had a big problem with this today. Based on my usage I probably would have ended the entire day with like 50-70%, but instead it heated up so much it switched from 5g to 4g temporarily and dropped from 100% to 30% in just the morning and early afternoon. This is when I checked and noticed AdGuard was using a lot of my battery, and saw the update. I stopped home and had time to charge up to 70% before work, but then after 5 hours of it almost entirely sitting in my pocket it managed to go from 70 to 30, even on the new update, when normally it would have dropped like 10-20% in this time.

@derKief
Copy link
Author

derKief commented Nov 5, 2024

@jordansworld
https://github.com/AdguardTeam/AdguardForAndroid/releases/tag/v4.5
there you can download the 4.5 apk file

@jordansworld
Copy link

Unfortunately, nothing has improved for me. As of version 4.6, the battery consumption on both my Samsungs has increased. So the problem is obviously not completely solved for everyone.

Samsung Galaxy A25: Screenshot_20241105_200153_GSam Battery Monitor Samsung Galaxy S24: Screenshot_20241105_200317_GSam Battery Monitor

All started with initial Version 4.6 and up I'm back to v4.5 which works like charm. In my case it must be something fundamental that has changed or been added since v4.6.

@artemiv4nov @ameshkov @Versty I have to mention again that the labels Resolved and Fixed should be removed because that is not the case and only misleads some users !!!

oh no i meant the appsucker app 🤭😅

@derKief
Copy link
Author

derKief commented Nov 5, 2024

This is GSAM Battery Monitor
But it's currently not available in the Play Store. No idea what happened. Maybe on apkmirror.

@jordansworld
Copy link

This is GSAM Battery Monitor But it's currently not available in the Play Store. No idea what happened. Maybe on apkmirror.

Found it on apkmirror. thankyou so much

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

Actually, what we're more interested in is internal Battery stats that AdGuard shows (Stats -> scroll down to battery usage).

Could you please post the screenshots (we're mainly interested in CPU time numbers).

Also, if you haven't disabled debug-level logging after sending the logs, it'd be helpful if you could send it again.

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

Meanwhile, let me please supply more details about what happened and why we're asking for AdGuard's battery stats.

General notes about Battery usage

Battery usage that all those apps show you (GSam, Android's internal stats, etc) are combined from two basic numbers:

  • Data usage
  • CPU usage

Data usage is something we cannot influence as AdGuard sits between your apps and the Internet and naturally Android counts all your apps' data usage towards AdGuard.

CPU usage is what we can work with and what we can optimize. There are some cases when we cannot, but they're pretty rare. For instance, some app may start misbehaving when an ad or a tracker is blocked and start constantly bombarding us with ad requests. There were such cases in the past with Google Analytics, some apps were attempting to get to it and the numbers of blocked requests could up to millions. Anyways, this thing is easy to see in the apps stats, if you don't see millions requests in the stats then you're probably okay.

What numbers are okay

In our experience CPU usage for 24 hours should be in the range of 0 to 30-40 minutes (it's counted in minutes, yes). It could go up to 60 minutes if you spend a lot of time with the phone.

Anything higher than 60 minutes may signal about an issue.

v4.6 CPU usage issue

Unfortunately, in v4.6 we made a pretty serious mistake that lead to high CPU usage numbers.

Here's what happened:

  1. AdGuard app records aggregated stats (how many requests were processed, which domains were blocked, etc.)
  2. If we were keeping the raw stats it could use too much space so once in a while the app attempts to "compress" the statistics. To put it simple, it goes through all the stats and merges older stats records. Old 1-hour records are merged to 6-hour records, older 6-hour records are merged to 1-day records, etc.

In order to iterate through these time periods we were using java.util.Calendar class.

Here is a VERY simplified pseudo-code that goes through time periods (in reality it's more complicated, goes through hours first, then switches to longer periods, etc, but it's not important for the demonstration):

while (nextTimeInMilliseconds > 0) {
    nextTimeInMilliseconds = truncateTimeToHour(nextTimeInMilliseconds - 1)
    doMerge()
}

What was missed is how Calendar deals with time changes. On the 3rd of November there was a time change in the US (end of daylight saving time) and we ended up in a situation where "truncating" timestamp to hh:00 returned a timestamp that was equal to the previous hour. This in turn lead to an infinite loop in this part of the code constantly running and using extra CPU.

We now fixed this and checked that all kinds of time changes are handled properly so I seriously doubt you can run into the same issue again so please make sure you're using build 204. There's one clear signal that higher CPU usage is caused by stats: if right after the startup the usage is okay, but exactly 30 minutes after startup it starts overusing, then this is it.

@muchqs
Copy link

muchqs commented Nov 6, 2024

Thank you guys for the new version for us Obtainium users.

I updated from v4.5 as I had to downgrade because the heat created by v4.6.4 was crazy.

And so far it looks like it's fixed for me.

Screenshot 1: CPU temp is normal now. Cores downclock as normal. (it was 70C on v4.6.4, and most CPU cores never downclocked).

Screenshot 2: I installed the fixed version at 19:50. The Android battery stat shows for the next 2 hours AdGuard battery usage was at bottom.

Screenshot 3: AdGuard battery stat screen shows little battery usage. The two extra graphs I just want to show the timestamp. Since the installation at 19:50, the battery usage is flat.

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

Thank you guys for the new version for us Obtainium users.

Thanks for mentioning Obtainium, frankly, we never heard about it before but it seems to be an interesting alternative to app stores.

@0xrxL
Copy link

0xrxL commented Nov 6, 2024

AdGuard 4.7 Nightly 42...it's all ok now, seems

Screenshot_20241106_100520_Device care

Screenshot_20241106_100701_AdGuard

@0xrxL
Copy link

0xrxL commented Nov 6, 2024

Can be useful or not, but I made a fresh installation of this nightly. Maybe this approach prevented the overwrite of old (and bugged) data?

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

Please ignore the issue status, this is how our internal task tracker works, we're following the discussion.

@derKief
Copy link
Author

derKief commented Nov 6, 2024

A little over 2 hours ago I reinstalled build 204.

You can clearly see from the screenshot of the Adguard statistics and also from the Thermal Guardian that the CPU load/usage has increased since the installation.

It is noticeable that 2 CPU cores are running at the highest frequency the whole time. Unfortunately I don't have an app that records the frequencies over a period of time and therefore can't take a screenshot.

Unfortunately, I forgot to create another debug log. But it won't be much different from the last one since the same behavior can be observed.

And before any questions arise. The device was not in energy saving mode!

I can only repeat myself... there must be something else wrong with version 4.6 and above. If I only had the problem on one device, I would say it was the fault of that device, but now 3 devices in my household are affected. That can't be a coincidence.

Screenshot_20241106_110148_AdGuard
Screenshot_20241106_110231_Thermal Guardian
Screenshot_20241106_104305_DevCheck

@derKief
Copy link
Author

derKief commented Nov 6, 2024

Please ignore the issue status, this is how our internal task tracker works, we're following the discussion.

I see this as very negative because the topic is no longer in focus. To be honest, it annoys me.
Exactly the same as with the old case. Although it wasn't really solved, the ticket was closed.
I don't think that's a good thing

Maybe I should create a new ticket?

@muchqs
Copy link

muchqs commented Nov 6, 2024

Thank you guys for the new version for us Obtainium users.

Thanks for mentioning Obtainium, frankly, we never heard about it before but it seems to be an interesting alternative to app stores.

It would be nice if AdGuard could have the same version number for posted "version name" and the package version. Obtainium detects the package version then checks GitHub and sees the posted version doesn't match so it thinks there's a new version out and notifies the user, despite the fact the user is already on the newest version. Just a suggestion.

On the battery issue, it's weird it seems fixed for me but not for others. But it's been less than 24hours since my installation. I'll post another AdGuard battery stat screen after 24hours later.

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

@0xrxL

Can be useful or not, but I made a fresh installation of this nightly. Maybe this approach prevented the overwrite of old (and bugged) data?

It shouldn't matter, the issue that I described would've reoccurred anyways.

@derKief let's wait for other people to report and then we can open a new issue about that. Hopefully, by that time we'll have some clarity on what's causing it this time.

I apologize for the issue taking so long to troubleshoot, but I'd appreciate if you could enable debug log one more time and record it for 60 minutes more.

And one more quick question: please open Android settings -> Date & Time -> tell me what time zone do you have there (region is also important)
image

@derKief
Copy link
Author

derKief commented Nov 6, 2024

@ameshkov
i will do another debug log recording for a longer period of time. ill report back then.
About that timezone region question... everything is on automatic and so no timezone and region are displayed. When switching to manual mode than Berlin and Germany are displayed.
Remember this is a Samsung device with One UI and it never was a problem before with automatic mode.

@sanjay51
Copy link

sanjay51 commented Nov 6, 2024

Drained my Samsung Flip 5 battery from 40%->1% overnight. Adguard is the top culprit according to battery management. Didn't happen before so has to be something about the new update. I,
1/ Disabled DNS protection, will see if that improves
2/ Installed the latest release from today, will see if that improves.
3/ If nothing else, I'll just live with it and charge my phone twice a day, because I love adguard.

@derKief
Copy link
Author

derKief commented Nov 6, 2024

@0xrxL

Can be useful or not, but I made a fresh installation of this nightly. Maybe this approach prevented the overwrite of old (and bugged) data?

It shouldn't matter, the issue that I described would've reoccurred anyways.

@derKief let's wait for other people to report and then we can open a new issue about that. Hopefully, by that time we'll have some clarity on what's causing it this time.

I apologize for the issue taking so long to troubleshoot, but I'd appreciate if you could enable debug log one more time and record it for 60 minutes more.

@ameshkov
The new recorded degub log is just sent by e-mail. This time its a few hours.
I hope this helps to find the error on my devices.

@shwarcu
Copy link

shwarcu commented Nov 6, 2024

I have experienced problem with battery drain on my girlfriend's S23 Ultra. It has adguard version 4.6.4 (however Android app settings section says it's 4.6.204).
Battery was drained really fast and smartphone was significantly warm.

Android settings reported that app data was 140GB ❗
I deleted it all and performed setup of adguard again before I found this GitHub issue.

I will try to gather logs when problem reappears.

Weird fact: I also have S23 Ultra and also adguard 4.6.4 but this problem doesn't seem to affect my unit.

@ameshkov
Copy link
Member

ameshkov commented Nov 6, 2024

@derKief received the log, thank you!

I quickly skimmed through it and tbh I don't see issues related to stats merging in the log (thank god this one seems to be fixed for good).

How we record&calc battery usage

Regarding overall CPU usage, let me explain what I see in the log.

  1. First of all, AdGuard periodically asks Android to measure its CPU usage by using SystemHealthManager#takeMyUidSnapshot() and extracting kernel CPU time and user CPU time. The apps like GSAM (and Android's own Battery app) use the very same API to get battery usage stats.

  2. When AdGuard does that it prints something like this to the log:
    Calculated battery usage: 1730898020945 6645 54451 0 0 0 false

    • 1730898020945 is the timestamp
    • 6645 is the process ID
    • 54451 is CPU usage in jiffies since the last time battery usage was calculated
    • 0 is the CPU usage of child processes (AdGuard does not spawn child processes so it will always be 0.
    • 0 0 this is AdGuard's own cellular and wifi bytes usage, i.e. something that AdGuard downloads on its own (filters updates, etc.)
    • false is whether the app is currently in foreground or not.

These numbers are then summed up and that's how we calculate AdGuard's own battery usage.

The log (13:21:59 - 19:12:19)

In the log there are just a few records with battery usage measurements:

Log records with measurements
13:21:59.038 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730895719029 6645 5531 0 0 113478 true

13:22:06.468 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730895726467 6645 0 0 0 475077 false

14:00:20.949 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730898020945 6645 54451 0 0 0 false

14:56:08.057 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730901368056 6645 54398 0 0 0 false

15:20:21.894 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730902821892 6645 12083 0 0 0 true

15:20:36.775 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730902836775 6645 0 0 0 24109 false

15:57:43.899 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730905063897 6645 45901 0 0 0 false

18:45:22.246 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730915122245 6645 49464 0 0 0 false

19:12:07.968 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730916727966 6645 13473 0 0 0 true

19:12:16.552 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730916736550 6645 0 0 0 4576 false

19:12:19.842 [battery-manager-pool-15-thread-1] INFO  s.d - Calculated battery usage: 1730916739840 6645 0 0 0 0 true

So the overall CPU usage for this 6-hours period is (5531 + 54451 + 54398 + 12083 + 45901 + 49464 + 13473) * 10 which is 2353010 milliseconds or about 39 minutes of CPU time.

Not ideal indeed, but all these measurements also depend on the usage profile a lot.

@derKief I apologize for asking (and we'll definitely try to compensate for bothering you once we fix this), but could you please do one more thing. Could you please downgrade to v4.5 and record a debug-level log there as well? I'd like to understand what's the difference is there with v4.5 and look for the clues by comparing two logs.

@derKief
Copy link
Author

derKief commented Nov 6, 2024

@ameshkov
I just sent the debug log for v4.5 just before I go to bed 😀
It wasn't created over a very long period of time like the one for v4.6 just ~3h. I hope that this still works for comparison purposes.

@ameshkov ameshkov changed the title High battery consumption since v4.6.x High battery consumption in v4.6.4 due to infinite loop in statistics calculation Nov 7, 2024
@ameshkov
Copy link
Member

ameshkov commented Nov 7, 2024

Got the log, thank you!

I've created a new issue about that. Not yet sure what's causing this in your case, we're looking into it. Mainly, we need to understand how to reproduce this on our test devices.

New issue: #5505

@derKief
Copy link
Author

derKief commented Nov 7, 2024

@ameshkov Thanks a lot

@muchqs
Copy link

muchqs commented Nov 7, 2024

It's been way more than 24 hours. This is what I see in AdGuard battery screen. 36min CPU time. Is this normal?

I noticed CPU usage and temp spike up a lot when using the Bing app, phone gets heated real quick. Battery dropped by about 6% in only 12 minutes!! I'm not sure if this is because a lot of trackers are blocked so Bing goes crazy trying to contact them or if there's something wrong with AdGuard.

@ameshkov
Copy link
Member

ameshkov commented Nov 8, 2024

Is this normal?

36 min is just okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests