Facebook Says It Fixed A Bug That Caused Silent Audio To Vampire Your iPhone Battery

Facebook engineering manager Ari Grant has posted an explanation for the recent issues with the app gorging itself on power. Grant says that the battery issues were caused by a series of bugs including one that ate up extra CPU cycles, causing Facebook to use up more of your iPhone battery than it should.

After a post by Circa co-founder Matt Galligan and followups by Federico Viticci and Nick Heer caused some eyeballs to hit the issue, Facebook told us that it was looking into the problem and that it would put out a fix soon. That fix came today in an update to Facebook that should be available on your iOS device (though you wouldn’t know it from their release notes).

The other issue, that Facebook was running a silent audio stream in the background, is also called out. Grant says this was unintentional, and that it was not being used to keep the app alive — yet it did as a byproduct of the bug.

The first issue we found was a “CPU spin” in our network code. A CPU spin is like a child in a car asking, “Are we there yet? Are we there yet? Are we there yet?”with the question not resulting in any progress to reaching the destination. This repeated processing causes our app to use more battery than intended. The version released today has some improvements that should start making this better.

The second issue is with how we manage audio sessions. If you leave the Facebook app after watching a video, the audio session sometimes stays open as if the app was playing audio silently. This is similar to when you close a music app and want to keep listening to the music while you do other things, except in this case it was unintentional and nothing kept playing. The app isn’t actually doing anything while awake in the background, but it does use more battery simply by being awake. Our fixes will solve this audio issue and remove background audio completely.

For context, using background audio (via the VoIP calling entitlement) to keep an app awake is an old standard in the app kludge world. A popular storage company used it at one point to keep their app open to grab new photos to upload (before it switched to using ‘known locations’ to wake the app up).

And I’m aware of a bunch of other devs that have used the trick in one fashion or another to get their apps to do something Apple didn’t want them doing — things like leaving an app open constantly in the background to pre-load content or advertising, to upload or download files or the news feed or more auto-playing videos.

So if you believe Grant, this is a simple bug. It could happen to anyone, etc., etc. If you don’t believe him, it was a thing Facebook was doing to make their app work a way they wanted it to but Apple didn’t and they got caught. I’m not gonna pass any judgments here — bugs happen all of the time and it’s not fun to get pilloried over a simple mistake. Either way, attention was brought to it and it’s fixed now. For what it’s worth, I’ve heard that this was, as stated, a bug.

Whether it’s double checking for bugs or treating your users with respect, it’s important to remember that a mobile device’s battery is a finite resource. Using that resource wantonly can seriously inconvenience or, at worse, put lives at risk.