Many of us use an ad blocker on our Android devices, be it to reduce bandwidth usage, avoid tracking or simply get rid of visual distractions. The way ad-blockers work is simple: they block all requests to known domains that serve ads or allow analytics and tracking.

What happens when a network request fails? Well, what usually doesn't happen is having the application retry the request forever, hoping it'll work eventually. This is exactly what a rare bug in the Google Play Music application may be causing, which may result in some serious CPU usage and battery drain (and your device heating up). That's the effect of trying to make around 200 network requests per second:

        
06-11 22:20:17.957 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.957 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.960 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.960 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.963 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.963 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.966 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.967 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.970 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.970 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.973 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.973 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.976 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.976 17958 18144 W GoogleTagManager: Connection refused
06-11 22:20:17.987 17958 18144 W GoogleTagManager: Exception sending hit: ConnectException
06-11 22:20:17.987 17958 18144 W GoogleTagManager: Connection refused
Google Play Music CPU Usage

The bug seems to occur because Google Play Music tracks various user-initiated actions, such as opening an artist's page or playing a song. If you're blocking googletagmanager.com (AdAway does by default; most sources of domains to block include it as well, as it's used for analytics and tracking), you may be affected by this bug. To check if you are, follow these steps:

  1. Force stop the Google Play Music application.
  2. Open Google Play Music.
  3. Search for an artist (e.g. "Rick Astley").
  4. Tap the artist's thumbnail to open their page.
  5. Check your logcat and see if it's being spammed with the lines shown above.

Not all versions or users seem to be affected by this bug, but we are able to reproduce it on the latest one (7.8.4818-1.R.4063206) on some of our devices. As far as we can tell, this is a fairly obscure bug and while we're not sure what causes it exactly, the consequences for affected users are too important not to mention. A workaround to mitigate this issue (until the Google Play Music team takes note and fixes it) is to stop blocking googletagmanager.com by using your ad blocker's "whitelist" feature.

Android users are no stranger to seemingly untraceable sources of battery drain, overheating and random slowdowns. It's always nice to be able to track down - and exterminate - the root causes, so we hope that this guide helped you if you are one of the affected users. If you use adblockers and experience random drain, you also now know how to identify and solve possible causes.


Ever had similar experiences with ad blockers? How often do you suffer from random drains? Let us know in the comments.