Closed Bug 971593 Opened 9 years ago Closed 9 years ago

[RTSP] Resource leak of HTMLMediaElement containing RTSP media resource

Categories

(Firefox OS Graveyard :: RTSP, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(tracking-b2g:backlog)

RESOLVED FIXED
2.0 S1 (9may)
tracking-b2g backlog

People

(Reporter: ethan, Assigned: ethan)

References

Details

(Whiteboard: [p=1])

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.
Assignee: nobody → ettseng
Blocks: 945603
Severity: normal → blocker
Priority: -- → P1
Component: General → RTSP
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.
Depends on: 992568
This bug will be resolved by bug 992568 (Refactor RtspChannel to support HTTP->RTSP redirection and rendering inside the browser).
Status: NEW → ASSIGNED
blocking-b2g: --- → backlog
Resolved fixed by bug 992568.
RTSP doesn't leak resource now.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [p=1]
Target Milestone: --- → 2.0 S1 (9may)
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.