Closed
Bug 1341924
Opened 8 years ago
Closed 8 years ago
"Assertion failure: cancelable (Only nsICancelableRunnable may be dispatched to a worker!)" triggered by profiler
Categories
(Core :: Gecko Profiler, defect)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla55
People
(Reporter: n.nethercote, Assigned: n.nethercote)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
STR: debug build, start profiler.
Click on profiler button, then Settings, Threads; and enter
"," (a single comma) in the box. Profiler typically asserts shortly afterwards. Sometimes the assertion in bug 1340193 hits first, though.
Stack trace:
> #0 0x00007fffe7989a66 in mozilla::dom::workers::WorkerThread::Dispatch(already_AddRefed<nsIRunnable>, unsigned int) (this=0x4139a40, aRunnable=..., aFlags=<optimized out>) at /home/sewardj/MOZ/MC-TALL/dom/workers/WorkerThread.cpp:235
> #1 0x00007fffe8f5d6d9 in nsIEventTarget::Dispatch(nsIRunnable*, unsigned int) (aFlags=0, aEvent=<optimized out>, this=0x4139a40) at /home/sewardj/MOZ/MC-TALL/ff-Og-linux64-dbg/dist/include/nsIEventTarget.h:37
> #2 0x00007fffe8f5d6d9 in ThreadResponsiveness::Update(bool, nsIThread*) (this=this@entry=0x7ffecc1bde80, aIsMainThread=<optimized out>, aThread=0x4139a40) at /home/sewardj/MOZ/MC-TALL/tools/profiler/gecko/ThreadResponsiveness.cpp:105
> #3 0x00007fffe8f5d8e9 in ThreadInfo::UpdateThreadResponsiveness() (this=0x7ffecc1bdbe0) at /home/sewardj/MOZ/MC-TALL/tools/profiler/core/ThreadInfo.h:81
> #4 0x00007fffe8f5d8e9 in SigprofSender(void*) (aArg=<optimized out>) at /home/sewardj/MOZ/MC-TALL/tools/profiler/core/platform-linux.cc:290
> #5 0x00007ffff7bc06ca in start_thread (arg=0x7ffeebfff700) at pthread_create.c:333
> #6 0x00007ffff6e4ef7f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105
The cause here is clear: we dispatch a non-cancelable runnable to a worker thread, which is not allowed. Changing CheckResponsivenessTask to be cancelable should fix it. This should be as simple as adding a Cancel() method to it.
Assignee | ||
Comment 1•8 years ago
|
||
This avoids the assertion. An even simpler option was to use the default
Cancel() which is a no-op, but changing Terminate() to Cancel() seemed
reasonable.
Attachment #8840252 -
Flags: review?(mstange)
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → n.nethercote
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•8 years ago
|
||
bkelly, we discussed this on IRC. Do you have any comments? Thanks.
Flags: needinfo?(bkelly)
Comment 3•8 years ago
|
||
Comment on attachment 8840252 [details] [diff] [review]
Make CheckResponsivenessTask cancelable
This seems reasonable, but I think there are more problems in ThreadResponsiveness.cpp when dealing with worker threads.
For example, it appears you can dispatch this thing at a worker thread. That's fine. But then it schedules a timer. When the timer fires it dispatches at the main thread. Which triggers another timer, but targeting the main thread this time. After that it just keeps running on the main thread and not on the originally targeted worker thread.
I have to question what this is trying to do and if it works at all for anything other than main thread.
Also, in Cancel(), please check for the existence of mTimer and call mTimer->Cancel() if its present.
Flags: needinfo?(bkelly)
Attachment #8840252 -
Flags: review?(mstange) → review-
Comment 4•8 years ago
|
||
Markus, do you have any ideas about the issues in comment 3?
Flags: needinfo?(mstange)
Comment 5•8 years ago
|
||
Now that you mention it, you're right! Responsiveness detection has never worked for non-main threads. I even added a condition to the UI so that it would only display responsiveness information for the main thread, because the numbers for non-main threads were all wrong. And then I completely forgot about it and never tried to find out why that is.
So thanks for spotting this!
Flags: needinfo?(mstange)
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 10•8 years ago
|
||
mozreview-review |
Comment on attachment 8847202 [details]
Bug 1341924 - Don't attempt to dispatch CheckResponsivenessTasks to non-main threads.
https://reviewboard.mozilla.org/r/120206/#review122252
Attachment #8847202 -
Flags: review?(n.nethercote) → review+
Comment 11•8 years ago
|
||
Pushed by mstange@themasta.com:
https://hg.mozilla.org/integration/autoland/rev/ec3fa55ae9e5
Don't attempt to dispatch CheckResponsivenessTasks to non-main threads. r=njn
Comment 12•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•8 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•