Closed Bug 1047416 Opened 10 years ago Closed 10 years ago

Wakelock leak on server response while disabled

Categories

(Firefox OS Graveyard :: FindMyDevice, defect)

defect
Not set
normal

Tracking

(b2g-v2.1 fixed)

RESOLVED FIXED
2.1 S2 (15aug)
Tracking Status
b2g-v2.1 --- fixed

People

(Reporter: ggp, Assigned: ggp)

References

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
gerard-majax
: review+
Details | Review
After bug 1030249 landed, we report to the server whenever FMD is disabled. However, our callback for server responses currently returns early when FMD is not enabled [1], and in that case a 'ping' alarm is not set [2]. The callback is called with a wakelock held, and that wakelock would have been released when the alarm is set.

STR:
1- Enable FMD
2- Disable FMD
3- Repeat steps 1 and 2 a few times, observe how a wakelock is leaked at each repetition.

1- https://github.com/mozilla-b2g/gaia/blob/26d76259aa04393d480057c0b04ef0494ec25e07/apps/findmydevice/js/findmydevice.js#L533
2- https://github.com/mozilla-b2g/gaia/blob/26d76259aa04393d480057c0b04ef0494ec25e07/apps/findmydevice/js/findmydevice.js#L577
Actually, the callback I linked to is not invoked after we report disabled; in fact, we don't have a callback for that at all [1], so it's no surprise that the wakelock is not being released :)

1- https://github.com/mozilla-b2g/gaia/blob/26d76259aa04393d480057c0b04ef0494ec25e07/apps/findmydevice/js/findmydevice.js#L227
Attached file gaia pull request
Work in progress PR; still need to add some tests.
Comment on attachment 8466222 [details] [review]
gaia pull request

PR updated, I believe this is ready for review.
Attachment #8466222 - Flags: review?(lissyx+mozillians)
Okay, so I can reproduce the leak:
08-06 16:13:03.783  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{}],"command":[]}
08-06 16:13:04.263  1408  1408 I GeckoDump: [findmydevice] releasing one wakelock, wakelocks are: {"clientLogic":[{},{}],"command":[]}
08-06 16:13:08.283  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{}],"command":[]}
08-06 16:13:24.863  1408  1408 I GeckoDump: [findmydevice] releasing one wakelock, wakelocks are: {"clientLogic":[{},{}],"command":[]}
08-06 16:13:25.043  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{}],"command":[]}
08-06 16:13:31.873  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{},{}],"command":[]}
08-06 16:13:32.273  1408  1408 I GeckoDump: [findmydevice] releasing one wakelock, wakelocks are: {"clientLogic":[{},{},{}],"command":[]}



08-06 16:14:40.823  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{},{}],"command":[]}
08-06 16:14:53.643  1408  1408 I GeckoDump: [findmydevice] releasing one wakelock, wakelocks are: {"clientLogic":[{},{},{}],"command":[]}
08-06 16:14:53.903  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{},{}],"command":[]}
08-06 16:14:56.483  1408  1408 I GeckoDump: [findmydevice] acquiring one wakelock, wakelocks are: {"clientLogic":[{},{},{}],"command":[]}
08-06 16:14:56.893  1408  1408 I GeckoDump: [findmydevice] releasing one wakelock, wakelocks are: {"clientLogic":[{},{},{},{}],"command":[]}
Comment on attachment 8466222 [details] [review]
gaia pull request

That does work fine, thanks. I left a couple of comments on Github, but it's more cosmetic.
Attachment #8466222 - Flags: review?(lissyx+mozillians) → review+
Keywords: checkin-needed
PR updated.
Master: https://github.com/mozilla-b2g/gaia/commit/a7458f19647193768ce15819bd34f528b69ae49f
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 2.1 S2 (15aug)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: