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

Battery Drain #4960

Closed
4 tasks done
loca-lhost opened this issue Sep 6, 2023 · 48 comments
Closed
4 tasks done

Battery Drain #4960

loca-lhost opened this issue Sep 6, 2023 · 48 comments

Comments

@loca-lhost
Copy link

loca-lhost commented Sep 6, 2023

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

AdGuard version

4.2.71

Environment

- OS:Android 13
- Device:Note 11 Pro 5G 
- Firmware:MIUI 14

Root access

  • Yes, I have it.

What filters do you have enabled?

No response

What Stealth Mode options do you have enabled?

No response

Issue Details

I have observed over some period a huge battery drain. It can take upto 50% of my SOT for a period of 24 hrs if I use auto proxy mode. Currently it sits at 28%. Version 3 never crossed the 5% threshold for same period. Inside the apps statistics it's even worse as it spikes randomly especially if you manually check for update.

Expected Behavior

It shouldn't be draining battery. And the statistics is way off.

Actual Behavior

Battery statistics ib the app and android battery estimates are just beyond normal. Huge battery drain.

Screenshots

Screenshot_2023-09-06-02-37-23-677_com miui securitycenter
Screenshot_2023-09-06-02-37-44-262_com adguard android

Additional Information

No response

@androidacy-user
Copy link

If an app is requesting a lot of ads, it will drain battery that android will attribute to Adguard. Make sure you don't have an app, like YouTube constantly requesting ads or something.

@AlgorithmOfGithub
Copy link

If an app is requesting a lot of ads, it will drain battery that android will attribute to Adguard. Make sure you don't have an app, like YouTube constantly requesting ads or something.

Same problem here, on versions 3.#.# not that much battery drain but i check issues sometimes none talk about it, i didnt open issue about it.

@loca-lhost
Copy link
Author

Same usage but the drain wasn't noticeable. Even earlier version 4 was better amid the constant restarts

@Versty Versty added the Root Issues that involve root rights label Sep 18, 2023
@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @loca-lhost could you be more specific about what apps you usually use? Does this happen if the phone is in sleep mode?

@Rtizer-9
Copy link

Rtizer-9 commented Sep 20, 2023

@loca-lhost there are some issues with automatic proxy as of now in the latest nightly versions which results in connection getting lost and some apps gets stuck while doing some operations like whatsapp backup which triggers at 2AM, truecaller/whatsapp contact sync.

I would suggest to install Better battery stats (root)- either stable or the xda edition (free) and observe the apps which are holding partial wakelocks and firing more than expected alarms in their respective tabs. I have observed whenever this battery drain happens in automatic proxy it's either some app with numerous entries with some "job sync" wakelock or "overflow" wakelock.

This way you will have a much better idea of which app is actually causing the drain.

It's also entirely possible that some other app is responsible for this. And since you're already on root I would suggest forcing deepsleep using some app and also monitoring whether deepsleep is working or not.

@maxikuzmin
Copy link
Contributor

@loca-lhost @AlgorithmOfGithub can you also export your settings and send them to devteam@adguard.com? Please include issue number 4960 in your email
It would be good to understand what your settings are and observe the power consumption with your settings

@maxikuzmin maxikuzmin assigned maxikuzmin and unassigned Versty Sep 20, 2023
@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @loca-lhost any news?
Can you also clarify, is this problem recurring with VPN mode?

@AlgorithmOfGithub
Copy link

AlgorithmOfGithub commented Sep 26, 2023

@maxikuzmin Hi, sorry for late answer. Let me answer fastly your questions.
Note: all i test on new and old phones (huawei phones with custom rom and apps)
1-before adguard issue It kept draining the battery. so I researched the issues like; huawei android launcher, huawei system services, system interface. sometimes problem updates but when i check adguard statistics there is so much requests(like clear statistics after that 6-10k requests in 15-30 minutes). most of the requests came from DNS filter but i didnt find which app doing that. so i tried off 'Route traffic through Adguard' of app(huawei android launcher). Battery usage of the app started to decrease. also, if you try it on a slightly old and slow phone unroute the app you will see that the app runs smoother and faster. so question is most applications including system applications are route through to AdGuard maybe conflict eachother cause you cant optimized all apps around the world. I dont know actually. (i have not using constintly requesting app like youtube)
2-tried with custom adguard settings
3-issue on vpn mode and no root for me
4-how i can test i dont know but same phone just updated 3.#.# to 4.#.#. Battery usage increased. i didnt see on adguard statistics but phone battery statistics showed me it.
(if i cant explain pls write, sorry for bad english)

@loca-lhost
Copy link
Author

It quit stable in vpn and it hovers around 20 percent now. In auto proxy it goes beyond 30 percent

@maxikuzmin
Copy link
Contributor

@loca-lhost do you have a Huawei too?

@loca-lhost
Copy link
Author

Xiaomi

@maxikuzmin
Copy link
Contributor

@loca-lhost @AlgorithmOfGithub @Rtizer-9 does this repeat with Local VPN mode?

@Rtizer-9
Copy link

Rtizer-9 commented Oct 2, 2023

@maxikuzmin as far as I can recall, I think it does. At the moment I'm not using VPN mode because obviously why not "root proxy" when you have it and also vpn mode shuts down automatically a lot overnight.

@AlgorithmOfGithub
Copy link

@maxikuzmin , for me work on local vpn, the issue persist with last nightly and beta versions, i dont know how it works but maybe the issue is not about mode. I read that rewriting every line of code on 'total reengineering' that you wrote about version 4.0. What did change ?

@Rtizer-9
Copy link

Rtizer-9 commented Oct 2, 2023

I think that this is somehow related to that doh using that stale connection for too long bug. It's not exactly ag perhaps that drains the battery but the apps that get stuck like I mentioned above. I can see lots and lots of entries with "job" and Android wakeup alarms with the most being "job.deadline" intent.

@maxikuzmin
Copy link
Contributor

@Rtizer-9 @loca-lhost @AlgorithmOfGithub in 3 days of using AdGuard I haven't seen this problem. But I tested on Pixel 5 with Android 14, maybe the problem is in the system.
Could you please send your logs? I hope you have Debug mode enabled :)
Mail for sending logs is the same devteam@adguard.com don't forget to specify issue number 4960
Let's see if we can figure out the problem

@Rtizer-9
Copy link

Rtizer-9 commented Oct 3, 2023

I'm using this whole setup with Wireguard kernel mode so I'm not really sure what's exactly causing the problem and if it would be of any use to you.

To solve the problem I'm using persistent keep alive in both ag and Wireguard (I thought this would stop frequent disconnection and keep the connection alive) and I'm not seeing any battery drain since many days.

PS: I'm on Android 13 not 14.

@maxikuzmin
Copy link
Contributor

@loca-lhost @AlgorithmOfGithub do you still continue to have severe battery drain?
@AlgorithmOfGithub have you now disabled Huawei Android filtering? Has the battery consumption become less?

@loca-lhost
Copy link
Author

On automatic proxy it still drains. Vpn mode is tolerable

@AlgorithmOfGithub
Copy link

AlgorithmOfGithub commented Oct 6, 2023

@maxikuzmin,
1-on my side, when I disable the redirect some Huawei applications on Adguard, battery consumption decreases.(vpn mode)
2-I have to use an old Huawei phone for a certain time, and the information I will transfer will not be healthy. cause battery not good. Note: information that i transferred before for new huawei phone (huawei nova 10 pro (android))

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @loca-lhost @Rtizer-9 I've been watching my device for a long time, but the problem has never recurred.
It may depend on the configuration, or some apps that may not have internet access, and other factors.
Could you please observe Recent activity? Maybe some apps are making a lot of requests and consuming power

@Rtizer-9
Copy link

Rtizer-9 commented Nov 7, 2023

I'm also not having any issues for the past few weeks.

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @loca-lhost any news?

@loca-lhost
Copy link
Author

It's better now. Been a while since I used http proxy. Using vpn mode now.

@AlgorithmOfGithub
Copy link

AlgorithmOfGithub commented Nov 16, 2023

@maxikuzmin, if there is a problem, probably other users will notice this too with updates. Thanks for handle, i will send the data from a more stable phone.

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub how are your observations? Are you seeing a large amount of requests from any applications?

@AlgorithmOfGithub
Copy link

@maxikuzmin hi, I dont see any extra requests from any application. However it seems like it is receiving extra requests and consumes battery on the phones I use. As I said, I will send you the information when I get a new and stable phone.

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub I continue to monitor power consumption on several devices, so far no anomalies unfortunately. I hope to get logs from issue users via AdGuard VPN to understand the issue in more detail.
Please, if you have this happen again, upload the logs too

@Rtizer-9
Copy link

Rtizer-9 commented Dec 6, 2023

@maxikuzmin I'm using Adguard with another proxy app and was facing ag crashes after screen off. I turned on ag watchdog and set it to highest=300s which resulted in "check alive" alarm from ag which triggers a lot and probably forces the system to come out of sleep, which results in ~1%/hr battery drain overnight.

When I again disabled watchdog, drain is back to ~2% overnight.

From my experience I've seen these kinds of battery drain with ag :

  1. You're using an app and somehow a connectivity issue happens (maybe due to a nightly issue) and then the app keeps trying but this whole cycle keeps going on which can be seen as "overflow" partial wakelock as I've mentioned earlier in this thread.

  2. Watchdog turned on

In the above cases your phone's natural idle drain too comes into place which you might also be counting and attributing completely to ag.

  1. Again a natural idle drain (happens when the phone has issues with deep sleep) with no interference from ag whatsoever but the user completely attributing it to ag.

@AlgorithmOfGithub
Copy link

@maxikuzmin I wanted to write when I experienced difficulties in daily use and saw a similar status information. Thanks for your interest despite the lack of information.

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @Rtizer-9 we've received enough logs from AdGuard VPN. We are investigating this issue, thanks!

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @Rtizer-9 we found what the problem is. It will be fixed in an upcoming update. Thank you very much for your information!
At the moment, the problem is AdGuard VPN

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @Rtizer-9 please test this in AdGuard VPN 2.7 Beta 1 released today or wait for the release version tomorrow, please let us know the results

@Rtizer-9
Copy link

Umm...I never talked anything about ag vpn. Isn't this issue about ag Android?

@maxikuzmin
Copy link
Contributor

@Rtizer-9 we had a power consumption issue due to the penultimate version of AdGuard VPN having too frequent integration mode checks. We fixed that and it should have fixed the power consumption issue.
Are you not using AdGuard VPN? Battery drain only when using AdGuard?

@maxikuzmin
Copy link
Contributor

@Rtizer-9 many people have already been helped by this solution with AdGuard VPN 2.7

@AlgorithmOfGithub
Copy link

@maxikuzmin hi, for me yes, issue for using adguard but probably my problem about my phone, just want to say it

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @Rtizer-9 is this still happening when using the latest versions of AdGuard 4.3.1 and AdGuard VPN 2.7?

@AlgorithmOfGithub
Copy link

@maxikuzmin hi, i dont use adguard vpn, yes still drain battery but problem is my phone so thanks for still attention.

@Rtizer-9
Copy link

@maxikuzmin yes I only faced battery issue with main ag app (I don't use VPN app) and as I've mentioned earlier it's been days since I faced battery drain specifically due to ag.

@rak-rak
Copy link

rak-rak commented Jan 4, 2024

@AlgorithmOfGithub @Rtizer-9 is this still happening when using the latest versions of AdGuard 4.3.1 and AdGuard VPN 2.7?

Issue is happening for me on two devices Samsung S22+ / Tab S9 (Android 14 stock) with
Adguard 4.3.1 and Adguard VPN 2.7.8.

Adguard VPN is disabled, but there is high battery consumption.

@AlgorithmOfGithub
Copy link

AlgorithmOfGithub commented Jan 4, 2024

As I said before, if there is, this problem will occurs for more users with new updates, except for me. i hope not problem.

@maxikuzmin
Copy link
Contributor

@AlgorithmOfGithub @rak-rak @Rtizer-9 we're looking into it, we're gonna need some time

@enakr
Copy link

enakr commented Jan 28, 2024

CRM #858809 - logs sent to devteam@adguard.com

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

10 participants