Closed Bug 1674158 Opened 4 years ago Closed 4 years ago

waitForNavigationCompleted doesn't clean-up listeners when running into a page timeout

Categories

(Remote Protocol :: Marionette, defect, P1)

Default
defect

Tracking

(Fission Milestone:M7, firefox-esr78 unaffected, firefox82 wontfix, firefox83 fixed, firefox84 fixed)

RESOLVED FIXED
84 Branch
Fission Milestone M7
Tracking Status
firefox-esr78 --- unaffected
firefox82 --- wontfix
firefox83 --- fixed
firefox84 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Regression)

Details

(Keywords: memory-leak, regression, Whiteboard: [marionette-fission-mvp][simple])

Attachments

(1 file)

Within waitForNavigationCompleted we register a couple of listeners (events, observer, message) that usually get all cleaned-up within checkDone.

Sadly all those registered listeners aren't cleaned-up in case of a page load timeout. The reason for that is the usage of the TimedPromise and that it internally rejects the promise, and the code in waitForNavigationCompleted doesn't use the catch or finally methods.

That's a regression from moving the navigation code into the parent process (bug 1612831).

Summary: Promise as returned by waitForNavigationCompleted doesn't clean-up listeners when running into a page timeout → waitForNavigationCompleted doesn't clean-up listeners when running into a page timeout

I actually noticed that while working on bug 1673823 where the MarionetteEvents actor could not be registered again after a call to a timing out WebDriver:NavigateTo command.

Blocks: 1673823

This is actually a memory leak now given that this code is in the parent process that lives all the time. When it was in the framescript it got cleaned-up after a remoteness change.

Keywords: memory-leak

Tracking marionette-fission-mvp bugs for Fission Beta milestone (M7).

Fission Milestone: --- → M7
Whiteboard: [marionette-fission-mvp] → [marionette-fission-mvp][simple]
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8dac5d18ef27
[marionette] waitForNavigationCompleted has to clean-up registered listeners. r=marionette-reviewers,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch

Comment on attachment 9184567 [details]
Bug 1674158 - [marionette] waitForNavigationCompleted has to clean-up registered listeners.

Beta/Release Uplift Approval Request

  • User impact if declined: Registered listeners for events and observer notifications are not removed and given that all the navigation code lives in the parent process now each navigation via Marionette adds another set of listeners. So this can leak quite a good amount of memory.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Moves unregistering of listeners into the finally block of the navigation Promise, so it to always gets called whether if the Promise gets resolved or rejected.
  • String changes made/needed: No
Attachment #9184567 - Flags: approval-mozilla-beta?

Comment on attachment 9184567 [details]
Bug 1674158 - [marionette] waitForNavigationCompleted has to clean-up registered listeners.

Fix for an important memory leak for Marionette uses, approved for 83 beta 8, thanks.

Attachment #9184567 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: