The default bug view has changed. See this FAQ.

Workers: Cycle collector calls DOM worker from wrong thread

RESOLVED FIXED

Status

()

Core
DOM
--
minor
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Irving, Assigned: Ben Turner (not reading bugmail, use the needinfo flag!))

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

###!!! ASSERTION: Wrong thread!: 'NS_IsMainThread()', file /Users/ireid/tbird/comm-central/mozilla/dom/workers/WorkerPrivate.cpp, line 1440


The cycle collector is calling down into the DOM Worker code, which asserts because it's being called outside the main thread. This is easily reproduced on my trunk Thunderbird build under debugger, so find me in #maildev if you need more details.


Stack trace:

#0	0x0000000101d4dc5c in mozilla::dom::workers::AssertIsOnMainThread() at /Users/ireid/tbird/comm-central/mozilla/dom/workers/WorkerPrivate.cpp:1441
#1	0x0000000101d4f901 in mozilla::dom::workers::WorkerPrivateParent<mozilla::dom::workers::WorkerPrivate>::AssertIsOnParentThread() const ()
#2	0x0000000101d4fa33 in mozilla::dom::workers::WorkerPrivateParent<mozilla::dom::workers::WorkerPrivate>::TraceInstance(JSTracer*) ()
#3	0x0000000101d4aa20 in (anonymous namespace)::Worker::Trace(JSTracer*, JSObject*) at /Users/ireid/tbird/comm-central/mozilla/dom/workers/Worker.cpp:262
#4	0x0000000103323f93 in js::gc::MarkChildren(JSTracer*, JSObject*) at /Users/ireid/tbird/comm-central/mozilla/js/src/jsgcmark.cpp:781
#5	0x00000001033240c1 in JS_TraceChildren ()
#6	0x00000001021a4198 in nsXPConnect::Traverse(void*, nsCycleCollectionTraversalCallback&) ()
#7	0x0000000102e7b2e1 in GCGraphBuilder::Traverse(PtrInfo*) ()
#8	0x0000000102e7b356 in nsCycleCollector::MarkRoots(GCGraphBuilder&) ()
#9	0x0000000102e7b518 in nsCycleCollector::BeginCollection(nsICycleCollectorListener*) ()
#10	0x0000000102e7ec0d in nsCycleCollectorRunner::Run() at /Users/ireid/tbird/comm-central/mozilla/xpcom/base/nsCycleCollector.cpp:3497
#11	0x0000000102e6188e in nsThread::ProcessNextEvent(bool, bool*) at /Users/ireid/tbird/comm-central/mozilla/xpcom/threads/nsThread.cpp:631
#12	0x0000000102defe26 in NS_ProcessNextEvent_P(nsIThread*, bool) at /Users/ireid/tbird/objdir-comm-central-permissions/mozilla/xpcom/build/nsThreadUtils.cpp:245
#13	0x0000000102e623c5 in nsThread::ThreadFunc(void*) at /Users/ireid/tbird/comm-central/mozilla/xpcom/threads/nsThread.cpp:272


Not sure if this will help, but:

(gdb) call DumpJSObject(aObj)
Debugging reminders...
  class:  (JSClass*)(obj->fslots[2]-1)
  parent: (JSObject*)(obj->fslots[1])
  proto:  (JSObject*)(obj->fslots[0])

0x1459d6af0 'native' <Worker>
  parent: 0x1459022b8 'native' <ChromeWindow>
    parent: null
    proto: 0x1459baa80 'native' <XPC_WN_ModsAllowed_NoCall_Proto_JSClass>
      parent: 0x1459022b8 'native' <ChromeWindow> (SEE ABOVE)
      proto: 0x11adb1e98 'native' <Object>
        parent: 0x1459022b8 'native' <ChromeWindow> (SEE ABOVE)
        proto: null
  proto: 0x1459d6a60 'native' <Worker>
    parent: 0x1459022b8 'native' <ChromeWindow> (SEE ABOVE)
    proto: 0x1459d6a18 'native' <WorkerEventTarget>
      parent: 0x1459022b8 'native' <ChromeWindow> (SEE ABOVE)
      proto: 0x11b401430 'native' <DOM Constructor.prototype>
        parent: 0x1459022b8 'native' <ChromeWindow> (SEE ABOVE)
        proto: 0x11adb1e98 'native' <Object> (SEE ABOVE)
Ah, I think we can ignore this. The assertion is just wrong here.
Summary: CG Cycle collector calls DOM worker from wrong thread → Workers: Cycle collector calls DOM worker from wrong thread
Is there any way to get rid of the assertion then? It's pretty disturbing to be trying to debug gecko-based stuff and have error messages like that flying out at you.
Created attachment 571136 [details] [diff] [review]
Patch

We just can't assert which thread we're on here.
Assignee: nobody → bent.mozilla
Status: NEW → ASSIGNED
Attachment #571136 - Flags: review?(jonas)
(In reply to Irving Reid (:irving) from comment #2)
> It's pretty disturbing to
> be trying to debug gecko-based stuff and have error messages like that
> flying out at you.

Of course. Just letting you know that in this one case it's harmless.
Severity: normal → minor
Attachment #571136 - Flags: review?(jonas) → review+
https://hg.mozilla.org/mozilla-central/rev/ae228e329b42
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.