Facebook iOS app update resolves battery drain, reasons for the bug explored

Posted by:
Date: Friday, October 23rd, 2015, 08:12
Category: iOS, News, Software


With any luck, this nipped the Facebook app’s battery drain issue.

Facebook on Thursday released a new version that it states will fix a major battery draining bug that some Facebook users have been experiencing in recent weeks. Affected users were seeing large amounts of battery drain on their iPhones due to Facebook running in the background, something that happened even when background app refresh was toggled off in the Settings app.

While the app’s release note don’t specifically reference the issue, Facebook engineering manager Ari Grant wrote a post explaining the issues behind the battery drain and what Facebook has done to fix it. According to Grant, there were several factors that contributed to the problem, including a “CPU spin” in the network code and silent background audio sessions that kept the app awake even when it wasn’t open.

Grant offered the following comment:

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.

When the Facebook battery issue broke, reporter Federico Vittici hypothesized it was caused by silent audio running in the background, which turned out to be correct. Vittici believed Facebook used silent audio intentionally as a way to keep the app active in the background for tasks like pre-loading content, which he said showed “a deep lack of respect for iOS users.”

No one is quite sure why this problem surfaced, although there’s been speculation that Facebook wanted to implement background audio for the app and wandered into the bug.

If you’ve tried the new version of the Facebook app and have any feedback to offer, let us know in the comments.

Via MacRumors and TechCrunch

Recent Posts