Open Bug 1517595 Opened 10 months ago Updated 9 months ago

WPT leaks in /encrypted-media/


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





(Reporter: mccr8, Unassigned)


(Depends on 1 open bug, Blocks 1 open bug)


(Keywords: memory-leak, Whiteboard: [MemShrink:P2])

LSan (and presumably the regular XPCOM leak checker) detects some leaks while running web platform tests in the /encrypted-media/ directory.

The leaks have stacks like:
leak at mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::SchedulerGroup::CreateEventTargets, mozilla::dom::TabGroup::TabGroup, mozilla::dom::nsIContentChild::GetConstructedEventTarget
leak at mozilla::EMEDecryptor::EMEDecryptor, mozilla::EMEDecoderModule::CreateAudioDecoder, mozilla::PDMFactory::CreateDecoderWithPDM, mozilla::MediaFormatReader::DecoderFactory::DoCreateDecoder
leak at Malloc, nsTArray_base, AppendElement, mozilla::CDMCaps::NotifyWhenKeyIdUsable
leak at NewPage, Push, mozilla::EventQueue::PutEvent, mozilla::ThreadEventQueue
leak at Alloc, nsTSubstring, nsTSubstring, nsTSubstring
leak at Malloc, nsTArray_base, ExtendCapacity, AppendElements
leak at mozilla::EMEDecryptor::EMEDecryptor, mozilla::EMEDecoderModule::CreateVideoDecoder, mozilla::MediaChangeMonitor::CreateDecoder, mozilla::MediaChangeMonitor::MediaChangeMonitor
leak at Realloc, nsTArray_base, AppendElement, mozilla::CDMCaps::NotifyWhenKeyIdUsable
leak at MakeUnique, mozilla::ChromiumCDMProxy::Init, InvokeMethod, InvokeCallbackMethod
leak at mozilla::dom::MediaKeys::CreateCDMProxy, mozilla::dom::MediaKeys::Init, mozilla::dom::MediaKeySystemAccess::CreateMediaKeys, createMediaKeys
Rank: 15
Priority: -- → P2
Whiteboard: [MemShrink] → [MemShrink:P2]

I started looking at this. I added logging to the ctor and dtor of SamplesWaitingForKey to figure out which is the 100 tests from this directory are leaking them.

The three tests that leak them are:
./mach wpt encrypted-media/clearkey-mp4-reset-src-after-setmediakeys.https.html
./mach wpt encrypted-media/clearkey-mp4-setmediakeys-again-after-playback.https.html
./mach wpt encrypted-media/clearkey-mp4-setmediakeys-multiple-times-with-the-same-mediakeys.https.html

I think there's a second kind of leak, but this is at least some place to start.

Depends on: 1522951
Depends on: 1523013

With bug 1523013, there's still a leak of a nsSocketTransport and some other networking stuff in the main process, but I'm hoping that's a separate issue, rather than a flaw with my patch for bug 1523013.

Depends on: 1524430

I could likely trim down the lsan-allowed list for this directory now, but these tests are disabled entirely in ASan at the moment, so I don't think it is worth the effort right now.

Depends on: 1522213
You need to log in before you can comment on or make changes to this bug.