Closed Bug 1352542 Opened 7 years ago Closed 7 years ago

nsTimerEvent::GetName() and nsTimerImpl::GetName() is not safe in timer thread

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox55 --- affected

People

(Reporter: sinker, Assigned: bevis)

References

Details

Attachments

(1 file, 1 obsolete file)

Since nsTimerEvent and nsTimerImpl is supposed to be referenced in timer thread, |GetName()| reasonably should be accessible in timer thread.  However, for some case, they raise some assertion fails.

I am working on bug 1351726.  It requires to access name of runnables in timer thread.

#0  0x00007fffe80a5cbe in nsContentSink::AddRef() (this=this@entry=0x7fffd8cd500
0) at /home/thinker/progm/mozilla-central/dom/base/nsContentSink.cpp:59
#1  0x00007fffe8e00985 in nsXMLContentSink::AddRef() (this=0x7fffd8cd5000)
    at /home/thinker/progm/mozilla-central/dom/xml/nsXMLContentSink.cpp:143
#2  0x00007fffe80a58ad in nsContentSink::QueryInterface(nsID const&, void**) (th
is=this@entry=0x7fffd8cd5000, aIID=..., aInstancePtr=aInstancePtr@entry=0x7fffe2
8fe418) at /home/thinker/progm/mozilla-central/dom/base/nsContentSink.cpp:70
#3  0x00007fffe8e007fd in nsXMLContentSink::QueryInterface(nsID const&, void**) 
(this=0x7fffd8cd5000, aIID=..., aInstancePtr=0x7fffe28fe468)
    at /home/thinker/progm/mozilla-central/dom/xml/nsXMLContentSink.cpp:141
#4  0x00007fffe759e700 in nsCOMPtr<nsINamed>::assign_from_qi(nsQueryInterface, n
sID const&) (this=this@entry=0x7fffe28fe4a0, aQI=..., aIID=...)
    at /home/thinker/progm/mozilla-central/obj-x86_64-pc-linux-gnu/dist/include/
nsCOMPtr.h:1115                          
#5  0x00007fffe759e865 in nsTimerImpl::GetName(nsACString&) (aQI=..., this=0x7ff
fe28fe4a0)                               
    at /home/thinker/progm/mozilla-central/obj-x86_64-pc-linux-gnu/dist/include/
nsCOMPtr.h:519                           
#6  0x00007fffe759e865 in nsTimerImpl::GetName(nsACString&) (this=0x7fffd8eff900
, aName=...)                             
    at /home/thinker/progm/mozilla-central/xpcom/threads/nsTimerImpl.cpp:658
#7  0x00007fffe758eb7d in nsTimerEvent::GetName(nsACString&) (this=<optimized ou
t>, aName=...)                           
    at /home/thinker/progm/mozilla-central/xpcom/threads/TimerThread.cpp:274
#8  0x00007fffe9ad9430 in mozilla::tasktracer::TracedRunnable::TracedRunnable(al
ready_AddRefed<nsIRunnable>&&) (this=0x7fffd8d371c0, aOriginalObj=<optimized out
>)                                       
    at /home/thinker/progm/mozilla-central/tools/profiler/tasktracer/TracedTaskC
ommon.cpp:106                            
#9  0x00007fffe9ad94ac in mozilla::tasktracer::CreateTracedRunnable(already_AddRefed<nsIRunnable>&&) (aRunnable=aRunnable@entry=<unknown type in /home/thinker/progm/mozilla-central/obj-x86_64-pc-linux-gnu/dist/bin/libxul.so, CU 0x1c397e68, DIE 0x1c3f0bf4>)
    at /home/thinker/progm/mozilla-central/tools/profiler/tasktracer/TracedTaskCommon.cpp:136
#10 0x00007fffe75a2fda in nsThread::DispatchInternal(already_AddRefed<nsIRunnable>, unsigned int, nsThread::nsNestedEventTarget*) (this=this@entry=0x7ffff6b71520, aEvent=..., aFlags=aFlags@entry=0, aTarget=aTarget@entry=0x0)
    at /home/thinker/progm/mozilla-central/xpcom/threads/nsThread.cpp:768
Maybe we should have the name in nsTimerImpl be initiated earlier while nsITimer::InitXxx() is called to prevent this thread-safe problem when doing QueryInterface on un-thread-safe XPCOM objects.

Does this make sense to you, Nathan?
Assignee: nobody → btseng
Flags: needinfo?(nfroyd)
Remove the assertion in TimerThread.
Attachment #8853555 - Attachment is obsolete: true
After more offline discussion, named runnables are not widely used (The most of the use cases are only done for qDOM on the main thread of content process.), so it's not a good option for TaskTracker.

Close this bug as WONTFIX.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(nfroyd)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: