Last Comment Bug 698860 - Workers: Cycle collector calls DOM worker from wrong thread
: Workers: Cycle collector calls DOM worker from wrong thread
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: x86 Mac OS X
: -- minor (vote)
: ---
Assigned To: Ben Turner (not reading bugmail, use the needinfo flag!)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-01 13:11 PDT by :Irving Reid (No longer working on Firefox)
Modified: 2011-11-06 13:01 PST (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (658 bytes, patch)
2011-11-01 13:51 PDT, Ben Turner (not reading bugmail, use the needinfo flag!)
jonas: review+
Details | Diff | Splinter Review

Description :Irving Reid (No longer working on Firefox) 2011-11-01 13:11:09 PDT
###!!! 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)
Comment 1 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-01 13:34:36 PDT
Ah, I think we can ignore this. The assertion is just wrong here.
Comment 2 :Irving Reid (No longer working on Firefox) 2011-11-01 13:45:33 PDT
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.
Comment 3 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-01 13:51:48 PDT
Created attachment 571136 [details] [diff] [review]
Patch

We just can't assert which thread we're on here.
Comment 4 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-01 13:52:52 PDT
(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.
Comment 5 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-05 12:46:22 PDT
https://hg.mozilla.org/mozilla-central/rev/ae228e329b42

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