AdguardForiOS icon indicating copy to clipboard operation
AdguardForiOS copied to clipboard

Severe battery drain while idle

Open ViRb3 opened this issue 3 years ago • 19 comments

Issue Details

This is likely the same issue as #1831. I don't know when it started, but my battery has been, for the past months, draining at least 30% overnight while the phone is idle/stand by. I disabled all apps' "Background data refresh", and the phone is always on strong signal Wi-Fi. I looked at the DNS logs first thing this morning and noticed that the same few reverse IP lookups are performed literally every 30 seconds, non-stop, forever. The IPs in question are all private IPs that do not exist on my Wi-Fi network.

Do you have any idea what could be causing this?

Thanks

Screenshot

Details

  • AdGuard version:
    • AdGuard for iOS 4.3.1(919)
  • Device model and storage size:
    • iPhone 12 128GB
  • Operating system and version:
    • iOS 15.2

ViRb3 avatar Jan 04 '22 23:01 ViRb3

I can confirm same issue at my end. Before going to sleep, I see battery percentage roughly at around 30-35% On waking up nearly 6-7 hours later, I see battery percentage plunged to 10-15% and then I go on to check battery stats, I see AdGuard Pro with some background activity continuously during entire night.

Also, I’m using VPN method to block custom ads on yahoo, particularly, m.yap.yahoo.com. I’m not sure if this VPN method is behind the battery drain. @ameshkov

VGisHere avatar Jan 05 '22 02:01 VGisHere

I turned off AdGuard before going to bed last night, and my battery drain was cut in half, around 15% per 8 hours now, instead of 30%. I still don't think this is normal, and I suspect that the constant DNS queries are still happening, they just drain less battery when not going through the overhead of AdGuard. Does anybody have a clue what is causing these queries?

ViRb3 avatar Jan 05 '22 14:01 ViRb3

Apple continuously performs some DNS queries, if you turn on VPN mode without any surfing, in no time, you would be able to see a lot of DNS queries to/from Apple, which IMO, can’t be turned off unless you turn off mobile data and WiFi. The main issue would probably be that why AdGuard consumes so much battery ! I’ll try out Native mode and see if there is any improvement in terms of battery consumption.

VGisHere avatar Jan 05 '22 15:01 VGisHere

The DNS queries in my case are all private (local) IPs though, they have nothing to do with Apple. I did see some Apple queries, but they were happening MUCH less often.

ViRb3 avatar Jan 05 '22 16:01 ViRb3

My observation is that the Native approach does less battery drain than the VPN approach. And the only reason I'm using VPN approach is to block "m.yap.yahoo.com" ! I wonder which all sites break if they add this to their blocking list.

VGisHere avatar Jan 06 '22 02:01 VGisHere

I looked at the DNS logs first thing this morning and noticed that the same few reverse IP lookups are performed literally every 30 seconds, non-stop, forever

This is actually a known issue, but it's not with the AdGuard app. We've seen it on AdGuard DNS and AdGuard Home before.

Sometimes bonjour service goes mad and starts doing these reverse lookups all the time. The only reliable way to make it stop is to reboot the device.

ameshkov avatar Jan 11 '22 08:01 ameshkov

Thanks a lot for your reply. I tried restarting my phone multiple times and I even wiped it, but the issue never stopped. But wow, this would explain why I was never able to solve it - all of my home is covered by AdGuard Home! I suspect you are blocking some domain in the adblock list that triggers this bug...

ViRb3 avatar Jan 11 '22 08:01 ViRb3

For what is worth, I also have iMazing set up on my Mac to backup my device over WiFi every day, so that's probably keeping a constant bonjour connection too.

ViRb3 avatar Jan 11 '22 08:01 ViRb3

@ViRb3 hm, how long did it start to occur? The latest version of AGH does indeed breaks DNS service discovery so it might be the issue: https://github.com/AdguardTeam/AdGuardHome/issues/4120

On the other hand, it shouldn't matter much. I've seen pretty similar reports with other DNS software, even without any filtering whatsoever.

ameshkov avatar Jan 11 '22 09:01 ameshkov

It's been happening for a few months unfortunately, at least since 11/2021. I don't think it's that specific issue in AGH. I will try to do a lot more experiments over the next few days, and I'll include disabling AGH too.

ViRb3 avatar Jan 11 '22 09:01 ViRb3

@ViRb3 Try changing blocked response TTL under low-level settings to a higher value, eg. 3600, seems to work for me. I have been searching around for a fix and this is my current solution. Something to do with bonjour discovery service, especially for custom DNS users.

NeutralGround avatar May 09 '22 08:05 NeutralGround

Interesting, please let me know if this helps.

ameshkov avatar May 09 '22 15:05 ameshkov

I'm actually facing high battery drains when device is idle on iOS 15.5 using the full tunnel mode for DNS blocking. Using a high TTL (7200s) didn't solve the issue. I'm using DNS over HTTPS with Cloudflare servers. iOS is constantly phoning home with ~800 requests to Apple names in only an hour !

Tratosca avatar Aug 16 '22 13:08 Tratosca

I'm actually facing high battery drains when device is idle on iOS 15.5 using the full tunnel mode for DNS blocking. Using a high TTL (7200s) didn't solve the issue. I'm using DNS over HTTPS with Cloudflare servers. iOS is constantly phoning home with ~800 requests to Apple names in only an hour !

How high? Need more details. For me, in the last 10 days it is 3%. Also, what is your blocking mode config? It is better to return 0.0.0.0 than REFUSED or NXDOMAIN as some apps may try to query further if latter.

NeutralGround avatar Aug 16 '22 17:08 NeutralGround

I'm actually facing high battery drains when device is idle on iOS 15.5 using the full tunnel mode for DNS blocking. Using a high TTL (7200s) didn't solve the issue. I'm using DNS over HTTPS with Cloudflare servers. iOS is constantly phoning home with ~800 requests to Apple names in only an hour !

How high? Need more details. For me, in the last 10 days it is 3%. Also, what is your blocking mode config? It is better to return 0.0.0.0 than REFUSED or NXDOMAIN as some apps may try to query further if latter.

As I recently switched again to AdGuard VPN implementation after having used iOS system wide DNS profile I'm waiting for iOS to correctly report battery consumption after a few days but for now it seems to be around ~12%. I'm using the default mode (which return a 0.0.0.0 IP) and my 2 blocklists are also using 0.0.0.0 as returned IP for blocked hosts.

Tratosca avatar Aug 16 '22 18:08 Tratosca

How large are your blocklists?

NeutralGround avatar Aug 17 '22 17:08 NeutralGround

How large are your blocklists?

I'm using BlackJack8´s "regular hosts.txt" rule with 14342 rules and a custom one with 184 rules.

Tratosca avatar Aug 17 '22 17:08 Tratosca

Could you share what are your most active domains/companies under activity page? Do switch to “all time”.

Also, how much battery drain do you experience after a night of shut eye?

NeutralGround avatar Aug 18 '22 06:08 NeutralGround

Could you share what are your most active domains/companies under activity page? Do switch to “all time”.

Also, how much battery drain do you experience after a night of shut eye?

It's by far Apple with ~12300 requests in two days ! Akamai is the second with ~4500 requests. Most of the requests aren't blocked but only SSLized using Cloudflare DNS over HTTPS servers. This night was good actually even if some requests were made: the app is showing in the battery usage screen this way image

But I was in power saving mode. Will try next night in normal mode and keep you informed. Thanks for your help.

Tratosca avatar Aug 18 '22 08:08 Tratosca