Open
Bug 1118206
Opened 10 years ago
Updated 3 years ago
Gecko Profiler uses nsThread before nsThreadManager is initialized
Categories
(Core :: Gecko Profiler, defect, P2)
Core
Gecko Profiler
Tracking
()
NEW
People
(Reporter: kanru, Unassigned)
References
(Blocks 1 open bug)
Details
Build with DEBUG enabled:
Program received signal SIGSEGV, Segmentation fault.
0xb54eb208 in assign_with_AddRef (aRawPtr=0xb6a41b00, this=0xb6a01ed0) at ../../dist/include/nsCOMPtr.h:1029
1029 NSCAP_ADDREF(this, aRawPtr);
(gdb) bt
#0 0xb54eb208 in assign_with_AddRef (aRawPtr=0xb6a41b00, this=0xb6a01ed0) at ../../dist/include/nsCOMPtr.h:1029
#1 operator= (aRhs=0xb6a41b00, this=0xb6a01ed0) at ../../dist/include/nsCOMPtr.h:547
#2 ThreadInfo::ThreadInfo (this=this@entry=0xb6a01eb0, aName=<optimized out>, aThreadId=<optimized out>, aIsMainThread=<optimized out>, aPseudoStack=aPseudoStack@entry=0xb6a67000,
aStackTop=aStackTop@entry=0xbefa57d2) at ../../../gecko/tools/profiler/platform.cpp:118
#3 0xb54eb36a in StackOwningThreadInfo::StackOwningThreadInfo (this=0xb6a01eb0, aName=<optimized out>, aThreadId=<optimized out>, aIsMainThread=<optimized out>,
aPseudoStack=0xb6a67000, aStackTop=0xbefa57d2) at ../../../gecko/tools/profiler/platform.cpp:145
#4 0xb54dccf6 in Sampler::RegisterCurrentThread (aName=0xb613aa82 "GeckoMain", aPseudoStack=aPseudoStack@entry=0xb6a67000, aIsMainThread=aIsMainThread@entry=true,
stackTop=stackTop@entry=0xbefa57d2) at ../../../gecko/tools/profiler/platform-linux.cc:479
#5 0xb54ea3ac in mozilla_sampler_init (stackTop=stackTop@entry=0xbefa57d2) at ../../../gecko/tools/profiler/platform.cpp:554
#6 0xb556b462 in profiler_init (stackTop=0xbefa57d2) at ../../dist/include/GeckoProfilerImpl.h:65
#7 GeckoProfilerInitRAII (stackTop=0xbefa57d2, this=<optimized out>) at ../../dist/include/GeckoProfiler.h:217
#8 XREMain::XRE_main (this=this@entry=0xbefa57f0, argc=argc@entry=1, argv=argv@entry=0xb6a2b190, aAppData=aAppData@entry=0xb6f74858 <_ZL8sAppData>)
at ../../../gecko/toolkit/xre/nsAppRunner.cpp:4169
#9 0xb556b6f2 in XRE_main (argc=1, argv=0xb6a2b190, aAppData=0xb6f74858 <_ZL8sAppData>, aFlags=<optimized out>) at ../../../gecko/toolkit/xre/nsAppRunner.cpp:4446
#10 0xb6f590e2 in do_main (argc=argc@entry=1, argv=argv@entry=0xb6a2b190) at ../../../gecko/b2g/app/nsBrowserApp.cpp:165
#11 0xb6f59220 in b2g_main (argc=argc@entry=1, argv=argv@entry=0xbefa6ac4) at ../../../gecko/b2g/app/nsBrowserApp.cpp:293
#12 0xb6f58f4c in RunProcesses (aReservedFds=..., argv=0xbefa6ac4, argc=1) at ../../../gecko/b2g/app/B2GLoader.cpp:225
#13 main (argc=1, argv=0xbefa6ac4) at ../../../gecko/b2g/app/B2GLoader.cpp:290
Reporter | ||
Comment 1•10 years ago
|
||
nsThreadManager::GetCurrentThread() uses PR_GetThreadPrivate without checking mInitialized first. Unfortunately PR_GetThreadPrivate doesn't check the validity of the index number so it returned some uninitialized non-null data.
Reviving this bug!
The code cited in comment 0 has probably changed since 2015(!), but we still entangle nsThread
stuff with the profiler, which can cause problems since the profiler lives before and after xpcom's lifetime.
I believe that we don't really need nsThreads in the profiler, it's only used to get thread names (and currently forward them to NS_SetCurrentThreadName
) -- to be confirmed.
If I'm correct, we could remove all references to nsThreads. This will also help with the Base/Gecko Profilers de-duplication.
Assignee: nobody → gsquelart
Blocks: 1557566
Severity: normal → S3
OS: Linux → All
Priority: -- → P2
Hardware: x86_64 → All
Sorry I didn't get to it.
Assignee: mozbugz → nobody
You need to log in
before you can comment on or make changes to this bug.
Description
•