Closed Bug 1421004 Opened 7 years ago Closed 7 years ago

Channels loading media as a top-level document are all leaked

Categories

(Core :: Audio/Video: Playback, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: mayhemer, Assigned: bechen)

References

Details

Attachments

(1 file)

STR:
1. load http://icecast.unitedradio.it/Virgin.mp3 directly
2. let it play a bit (few secs)
3. close the tab (but leave the browser running)
4. give it some time (1 minute) to confirm that GC when kicks in doesn't release
5. close the browser

The loading channel (http channel) is leaked because it's in Suspend() + Cancel() state and held by its consumers indefinitely.
Component: Audio/Video → Audio/Video: Playback
I'm making this a P2 on the assumption that it isn't difficult. If it proves to be difficult, feel free to reprioritise.
Priority: -- → P2
It's easily reproduced, the MediaElement had remove the "self reference" but not go into destructor.
So the problem may point to the MediaDocument/VideoDocument, it seems that the MediaDocumentStreamListener doesn't handle the shutdown case properly.
Assignee: nobody → bechen
Comment on attachment 8933558 [details]
Bug 1421004 - Break the mDocument reference cycle at Destroy().

https://reviewboard.mozilla.org/r/204490/#review210050

LGTM. But we need a DOM peer to make sure 'domwindowclosed' is the event we need to break the reference cycle.
Attachment #8933558 - Flags: review?(jwwang) → review+
If you're relying on `domwindowclosed`, you'll need to at least check `aSubject` is the outerWindow you expected. For your use case, you should probably just notify the stream listener to null out the reference inside `MediaDocument::Destroy`.
Comment on attachment 8933558 [details]
Bug 1421004 - Break the mDocument reference cycle at Destroy().

https://reviewboard.mozilla.org/r/204490/#review210554

So PluginDocument has https://searchfox.org/mozilla-central/source/dom/html/PluginDocument.cpp#135
Could we do the same thing here? Consistency would reduce the risk for regressions.
Could you please check all these media-like documents.

::: dom/html/VideoDocument.cpp:31
(Diff revision 3)
>                                       nsIStreamListener** aDocListener,
>                                       bool                aReset = true,
>                                       nsIContentSink*     aSink = nullptr);
>    virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
>  
> +  virtual void Destroy() {

{ goes to its own line here
Attachment #8933558 - Flags: review?(bugs)
Comment on attachment 8933558 [details]
Bug 1421004 - Break the mDocument reference cycle at Destroy().

https://reviewboard.mozilla.org/r/204490/#review210948

I guess we can do this. ImageDocument does still something a bit different and would be nice to have consistent handling also there, but that can be done in a different bug.
Attachment #8933558 - Flags: review?(bugs) → review+
See Also: → 1423154
Keywords: checkin-needed
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0c952f7d225
Break the mDocument reference cycle at Destroy(). r=jwwang,smaug
Keywords: checkin-needed
Flags: needinfo?(bechen)
Keywords: checkin-needed
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c0aeba8f81a2
Break the mDocument reference cycle at Destroy(). r=jwwang,smaug
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c0aeba8f81a2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: