Closed Bug 1675826 Opened 5 years ago Closed 9 months ago

Assertion failure: self->IsIdle(), at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:789

Categories

(Core :: DOM: Service Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox84 --- wontfix
firefox138 --- wontfix
firefox139 --- wontfix
firefox140 --- fixed

People

(Reporter: tsmith, Assigned: edenchuang)

References

(Blocks 1 open bug)

Details

(Keywords: assertion, testcase, Whiteboard: [bugmon:confirmed])

Attachments

(2 files)

Attached file testcase.zip

Assertion failure: self->IsIdle(), at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:789

#0 0x7f5036850229 in mozilla::dom::ServiceWorkerRegistrationInfo::ClearWhenIdle()::$_17::operator()(mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue const&) const src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:789:9
#1 0x7f503684ffd2 in InvokeMethod<(lambda at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:782:7), void ((lambda at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:782:7)::*)(const mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue &) const, mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue> /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:553:12
#2 0x7f503684ffd2 in InvokeCallbackMethod<false, (lambda at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:782:7), void ((lambda at src/dom/serviceworkers/ServiceWorkerRegistrationInfo.cpp:782:7)::*)(const mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue &) const, mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue, RefPtr<mozilla::MozPromise<bool, nsresult, true>::Private> > /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:584:5
#3 0x7f503684ffd2 in mozilla::MozPromise<bool, nsresult, true>::ThenValue<mozilla::dom::ServiceWorkerRegistrationInfo::ClearWhenIdle()::$_17>::DoResolveOrRejectInternal(mozilla::MozPromise<bool, nsresult, true>::ResolveOrRejectValue&) /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:837:7
#4 0x7f5032ca2b52 in mozilla::MozPromise<bool, nsresult, true>::ThenValueBase::ResolveOrRejectRunnable::Run() /builds/worker/workspace/obj-build/dist/include/mozilla/MozPromise.h:410:21
#5 0x7f50323d431f in mozilla::RunnableTask::Run() src/xpcom/threads/TaskController.cpp:450:16
#6 0x7f50323d298a in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:720:26
#7 0x7f50323d1a34 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:579:15
#8 0x7f50323d1be7 in mozilla::TaskController::ProcessPendingMTTask(bool) src/xpcom/threads/TaskController.cpp:373:36
#9 0x7f50323d7b76 in operator() src/xpcom/threads/TaskController.cpp:120:37
#10 0x7f50323d7b76 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_3>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:577:5
#11 0x7f50323e90f7 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1197:14
#12 0x7f50323eee3a in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:513:10
#13 0x7f5032cdab36 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:87:21
#14 0x7f5032c4ca23 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:334:10
#15 0x7f5032c4c93d in RunHandler src/ipc/chromium/src/base/message_loop.cc:327:3
#16 0x7f5032c4c93d in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:309:3
#17 0x7f5036944448 in nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:137:27
#18 0x7f503803b42e in nsAppStartup::Run() src/toolkit/components/startup/nsAppStartup.cpp:270:30
#19 0x7f5038144ae6 in XREMain::XRE_mainRun() src/toolkit/xre/nsAppRunner.cpp:5091:22
#20 0x7f5038145c8c in XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) src/toolkit/xre/nsAppRunner.cpp:5283:8
#21 0x7f5038146500 in XRE_main(int, char**, mozilla::BootstrapConfig const&) src/toolkit/xre/nsAppRunner.cpp:5339:21
#22 0x55e722d7f8c1 in do_main src/browser/app/nsBrowserApp.cpp:218:22
#23 0x55e722d7f8c1 in main src/browser/app/nsBrowserApp.cpp:336:16
Flags: in-testsuite?

A Pernosco session is available here: https://pernos.co/debug/8e5IcYJLoAoqEqe4v6yqkQ/index.html

Bugmon Analysis:
Unable to reproduce bug using the following builds:

mozilla-central 20201106160425-0e95e169ef40
mozilla-central 20201106041434-81a3ef82469b
Removing bugmon keyword as no further action possible.
Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon
Whiteboard: [bugmon:confirmed]
Severity: -- → S3
Priority: -- → P2
Keywords: bugmon
Whiteboard: [bugmon:confirmed] → [bugmon:confirm]

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220114220151-25ebce40c654.
Failed to bisect testcase (Unable to launch the start build!):

Start: 46713b21267a0769462b4a0cb6cbff4d3cbee901 (20210116092804)
End: 6083cdb61f421976f3fb97357b028f2d71d58924 (20210116214312)
BuildFlags: BuildFlags(asan=False, tsan=False, debug=True, fuzzing=True, coverage=False, valgrind=False, no_opt=False, fuzzilli=False)

Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]

OK, this is still a thing.

Flags: needinfo?(jstutte)
Flags: needinfo?(jstutte)
Whiteboard: [bugmon:bisected,confirmed] → [bugmon:confirm]

Bugmon can't analyze this at the moment due to a broken artifact. However, I can reproduce this issue locally but it is very unreliable.

Whiteboard: [bugmon:confirm] → [bugmon:confirmed]

Unable to reproduce bug 1675826 using build mozilla-central 20230304213046-b7c72ebf0fba. Without a baseline, bugmon is unable to analyze this bug.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Keywords: bugmon

It looks like bugmon tripped up again on the unreliability of this testcase. I can still reproduce this locally. I'm going to leave bugmon disabled to avoid this from happening again.

Looking at the code, i read:

   * Note that because we are using `MozPromise`, our callback will be invoked
   * as a separate task, so there is a small potential for races in the event
   * code if things are still holding onto the ServiceWorker binding and using
   * `postMessage()` or other mechanisms to schedule new events on it, which
   * would make it non-idle. However, this is a race inherent in the spec which
   * does not deal with the reality of multiple threads in "Try Clear
   * Registration".

right before the assertion.

If this is true, the assertion is probably overly ambitious and we should instead just handle that case (or ensure nothing bad happens with the current state) ?

Flags: needinfo?(echuang)

I think we can potentially use direct dispatch mode on the mozpromise to moot this; I don't know that we were aware of that option at the time.

Assignee: nobody → echuang
Status: NEW → ASSIGNED
Flags: needinfo?(echuang)
Pushed by echuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d52d7b5c5ad4 Making ServiceWorkerPrivate::mIdlePromiseHolder in DirectTaskDispatching mode. r=dom-worker-reviewers,asuth
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
QA Whiteboard: [qa-triage-done-c141/b140]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: