Closed Bug 1565344 Opened 5 years ago Closed 5 years ago

Intermittent Assertion failure: NS_IsMainThread(), at /builds/worker/workspace/build/src/caps/nsJSPrincipals.cpp:38

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- fixed
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: pehrsons)

References

(Regression)

Details

(Keywords: intermittent-failure, regression)

Attachments

(2 files)

Filed by: ncsoregi [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer.html#?job_id=255980237&repo=mozilla-central
Full log: https://queue.taskcluster.net/v1/task/LEHCJzD-RY-PzJiWW4gPng/runs/0/artifacts/public/logs/live_backing.log
Reftest URL: https://hg.mozilla.org/mozilla-central/raw-file/tip/layout/tools/reftest/reftest-analyzer.xhtml#logurl=https://queue.taskcluster.net/v1/task/LEHCJzD-RY-PzJiWW4gPng/runs/0/artifacts/public/logs/live_backing.log&only_show_unexpected=1


[task 2019-07-11T17:11:03.310Z] 17:11:03 INFO - REFTEST TEST-START | file:///builds/worker/workspace/build/tests/reftest/tests/dom/media/test/crashtests/1547899.html
[task 2019-07-11T17:11:03.310Z] 17:11:03 INFO - REFTEST TEST-LOAD | file:///builds/worker/workspace/build/tests/reftest/tests/dom/media/test/crashtests/1547899.html | 661 / 3779 (17%)
[task 2019-07-11T17:11:03.330Z] 17:11:03 INFO - ++DOMWINDOW == 35 (0x7fe5e710a800) [pid = 1135] [serial = 3281] [outer = 0x7fe5eb33ad40]
[task 2019-07-11T17:11:03.395Z] 17:11:03 INFO - Assertion failure: NS_IsMainThread(), at /builds/worker/workspace/build/src/caps/nsJSPrincipals.cpp:38
[task 2019-07-11T17:11:03.401Z] 17:11:03 INFO - #01: mozilla::OutputStreamManager::~OutputStreamManager() [dom/media/mediasink/OutputStreamManager.h:113]
[task 2019-07-11T17:11:03.402Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.403Z] 17:11:03 INFO - #02: mozilla::OutputStreamManager::Release() [dom/media/mediasink/OutputStreamManager.h:66]
[task 2019-07-11T17:11:03.403Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.403Z] 17:11:03 INFO - #03: mozilla::detail::RunnableFunction<mozilla::MediaDecoderStateMachine::AddOutputStream(mozilla::DOMMediaStream*)::$_37>::~RunnableFunction() [xpcom/threads/nsThreadUtils.h:555]
[task 2019-07-11T17:11:03.404Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.405Z] 17:11:03 INFO - #04: mozilla::Runnable::Release() [xpcom/threads/nsThreadUtils.cpp:54]
[task 2019-07-11T17:11:03.405Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.406Z] 17:11:03 INFO - #05: nsTArray_Impl<nsCOMPtr<nsIRunnable>, nsTArrayInfallibleAllocator>::ClearAndRetainStorage() [xpcom/ds/nsTArray.h:1300]
[task 2019-07-11T17:11:03.407Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.408Z] 17:11:03 INFO - #06: nsTArray_Impl<nsCOMPtr<nsIRunnable>, nsTArrayInfallibleAllocator>::~nsTArray_Impl() [xpcom/ds/nsTArray.h:884]
[task 2019-07-11T17:11:03.409Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.410Z] 17:11:03 INFO - #07: mozilla::AutoTaskDispatcher::PerThreadTaskGroup::~PerThreadTaskGroup() [xpcom/threads/TaskDispatcher.h:170]
[task 2019-07-11T17:11:03.413Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.414Z] 17:11:03 INFO - #08: mozilla::UniquePtr<mozilla::AutoTaskDispatcher::PerThreadTaskGroup, mozilla::DefaultDelete<mozilla::AutoTaskDispatcher::PerThreadTaskGroup> >::reset(mozilla::AutoTaskDispatcher::PerThreadTaskGroup*) [mfbt/UniquePtr.h:323]
[task 2019-07-11T17:11:03.415Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.417Z] 17:11:03 INFO - #09: mozilla::AutoTaskDispatcher::TaskGroupRunnable::~TaskGroupRunnable() [xpcom/threads/TaskDispatcher.h:177]
[task 2019-07-11T17:11:03.418Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.420Z] 17:11:03 INFO - #10: mozilla::Runnable::Release() [xpcom/threads/nsThreadUtils.cpp:54]
[task 2019-07-11T17:11:03.426Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.427Z] 17:11:03 INFO - #11: mozilla::TaskQueue::Runner::Run() [xpcom/threads/TaskQueue.cpp:210]
[task 2019-07-11T17:11:03.428Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.429Z] 17:11:03 INFO - #12: nsThreadPool::Run() [xpcom/threads/nsThreadPool.cpp:0]
[task 2019-07-11T17:11:03.429Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.430Z] 17:11:03 INFO - #13: non-virtual thunk to nsThreadPool::Run() [xpcom/threads/nsThreadPool.cpp:0]
[task 2019-07-11T17:11:03.431Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.434Z] 17:11:03 INFO - #14: nsThread::ProcessNextEvent(bool, bool*) [xpcom/threads/nsThread.cpp:1214]
[task 2019-07-11T17:11:03.436Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.436Z] 17:11:03 INFO - #15: NS_ProcessNextEvent(nsIThread*, bool) [xpcom/threads/nsThreadUtils.cpp:486]
[task 2019-07-11T17:11:03.437Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.437Z] 17:11:03 INFO - #16: mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) [ipc/glue/MessagePump.cpp:303]
[task 2019-07-11T17:11:03.439Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.440Z] 17:11:03 INFO - #17: MessageLoop::RunInternal() [ipc/chromium/src/base/message_loop.cc:315]
[task 2019-07-11T17:11:03.440Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.445Z] 17:11:03 INFO - #18: MessageLoop::Run() [ipc/chromium/src/base/message_loop.cc:291]
[task 2019-07-11T17:11:03.446Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.446Z] 17:11:03 INFO - #19: nsThread::ThreadFunc(void*) [xpcom/threads/nsThread.cpp:461]
[task 2019-07-11T17:11:03.447Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.510Z] 17:11:03 INFO - #20: _pt_root [nsprpub/pr/src/pthreads/ptthread.c:201]
[task 2019-07-11T17:11:03.511Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.512Z] 17:11:03 INFO - #21: libpthread.so.0 + 0x76ba
[task 2019-07-11T17:11:03.512Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.516Z] 17:11:03 INFO - #22: libc.so.6 + 0x10741d
[task 2019-07-11T17:11:03.517Z] 17:11:03 INFO -
[task 2019-07-11T17:11:03.518Z] 17:11:03 INFO - #23: ??? (???:???)
[task 2019-07-11T17:11:03.591Z] 17:11:03 INFO - [Parent 978, Gecko_IOThread] WARNING: pipe error (57): Connection reset by peer: file /builds/worker/workspace/build/src/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 358
[task 2019-07-11T17:11:03.591Z] 17:11:03 INFO - [Parent 978, Main Thread] WARNING: IPC message discarded: actor cannot send: file /builds/worker/workspace/build/src/ipc/glue/ProtocolUtils.cpp, line 568
[task 2019-07-11T17:11:03.594Z] 17:11:03 INFO - [Parent 978, Main Thread] WARNING: IPC message discarded: actor cannot send: file /builds/worker/workspace/build/src/ipc/glue/ProtocolUtils.cpp, line 568
[task 2019-07-11T17:11:03.627Z] 17:11:03 ERROR - A content process crashed and MOZ_CRASHREPORTER_SHUTDOWN is set, shutting down

Type: task → defect

This seems mostly triggered by dom/media/test/crashtests/1547899.html. In any case it comes from OutputStreamManager not releasing its mPrincipal member on the main thread.

Assignee: nobody → apehrson
Status: NEW → ASSIGNED
Component: Security: CAPS → Audio/Video: Playback
Priority: P5 → P2
Regressed by: 1423241

It would cause an assertion failure when OutputStreamManager was released on
main thread. It could be wrapped in an nsMainThreadPtrHandle instead, but that's
exactly what mPrincipalHandle is, so we can use that for both needs.

Pushed by pehrsons@gmail.com: https://hg.mozilla.org/integration/autoland/rev/b1758f1179c2 Remove unnecessary OutputStreamManager::mPrincipal. r=jib
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Looks like this issue affects ESR68 also, albeit low frequency. Is this worth a backport or should this fix just ride the regular trains?

Flags: needinfo?(apehrson)

Ah yes. It might be if the backport is easy enough. Let me have a look, there have been many changes in between 68 and this bug that could conflict, though not really affecting the little bits we changed here.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: This fixes the release of a main-thread only class on the wrong thread. It could mess with the refcount, leading in the best case to a leak, in the worst case a UAF, though I judge the latter as unlikely.
  • User impact if declined: Potential leak, possibly worse.
  • Fix Landed on Version: 70
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Trivial change, though the backport not going clean increases the risk somewhat. With the complexity being so low I still judge this as low risk.
  • String or UUID changes made by this patch:
Flags: needinfo?(apehrson)
Attachment #9096842 - Flags: approval-mozilla-esr68?
Comment on attachment 9096842 [details] [diff] [review] [esr68] Remove unnecessary OutputStreamManager::mPrincipal Fixes a leak and possible UAF. Approved for 68.2esr.
Attachment #9096842 - Flags: approval-mozilla-esr68? → approval-mozilla-esr68+
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: