Closed Bug 971593 Opened 7 years ago Closed 7 years ago
[RTSP] Resource leak of HTMLMedia
Element containing RTSP media resource
The reproduction of this bug is based on the WIP patch of bug 945603. With the WIP patch, we could render RTSP streaming inside the browser, just like HTTP streaming. But we found a critical resource leak problem of RTSP streaming. The HTMLMediaElement containing RtspMediaResource will never be released by cycle collector. From the analysis result of headgraph, we identified the "nsDocument" object has an unknown edge. 0x4417d000 [nsDocument normal (xhtml) rtsp://10.247.24.86/lance_burton.mp4] --[mChildren[i]]--> 0x44154c10 [FragmentOrElement (xhtml) html rtsp://10.247.24.86/lance_burton.mp4] --[mAttrsAndChildren[i]]--> 0x4415ee80 [FragmentOrElement (xhtml) body rtsp://10.247.24.86/lance_burton.mp4] --[mAttrsAndChildren[i]]--> 0x434da900 [FragmentOrElement (xhtml) video rtsp://10.247.24.86/lance_burton.mp4] Root 0x4417d000 is a ref counted object with 1 unknown edge(s). known edges: 0x43456190 [nsNodeInfoManager] --[mDocument]--> 0x4417d000 0x4343e210 [nsGlobalWindow #3] --[mDoc]--> 0x4417d000 0x438970a0 [JS Object (HTMLDocument)] --[UnwrapDOMObject(obj)]--> 0x4417d000 Then we identified the root cause by using GDB. MediaDocumentStreamListener, which holds a strong reference to nsDocument, will be constructed by RtspChannel. But its OnStopRequest function, which release the reference to nsDocument, is never called by RtspChannel.
Update some information. 1. We resolved more resource leaks of RTSP in bug 977518. Those resource leaks were all caused by cyclic references of RTSP components. We cannot fix this bug until those internal leaks are sorted out. Fortunately, bug 977518 is fixed right now. 2. This bug is to resolve the resource leak caused by the reference to nsDocument hold by MediaDocumentStreamListener. The fix of this bug could possibly involve changes of RtspChannel. We are refactoring RtspChannel in bug 949675, and the resource leak issue of this bug might be resolved in the refactoring patch.
This bug will be resolved by bug 992568 (Refactor RtspChannel to support HTTP->RTSP redirection and rendering inside the browser).
Resolved fixed by bug 992568. RTSP doesn't leak resource now.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S1 (9may)
You need to log in before you can comment on or make changes to this bug.