Bug 1342774 - Fix the deadlock caused by TaskTracer. r=cervantes
authorThinker K.F. Li <thinker@codemud.net>
Wed, 01 Mar 2017 00:57:00 -0500
changeset 374356 acf42887c8a7cf23ff677d49742cd6610545a38b
parent 374355 5ef0e255799d58592fbb7f70636cbb91c8b90c6a
child 374357 1bea491fae965da7d65cf345f67ca5fb870d4356
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscervantes
bugs1342774
milestone54.0a1
Bug 1342774 - Fix the deadlock caused by TaskTracer. r=cervantes
tools/profiler/tasktracer/TracedTaskCommon.cpp
--- a/tools/profiler/tasktracer/TracedTaskCommon.cpp
+++ b/tools/profiler/tasktracer/TracedTaskCommon.cpp
@@ -29,20 +29,24 @@ TracedTaskCommon::TracedTaskCommon()
 
 TracedTaskCommon::~TracedTaskCommon()
 {
 }
 
 void
 TracedTaskCommon::Init()
 {
+  // Keep the following line before GetOrCreateTraceInfo() to avoid a
+  // deadlock.
+  uint64_t taskid = GenNewUniqueTaskId();
+
   TraceInfoHolder info = GetOrCreateTraceInfo();
   ENSURE_TRUE_VOID(info);
 
-  mTaskId = GenNewUniqueTaskId();
+  mTaskId = taskid;
   mSourceEventId = info->mCurTraceSourceId;
   mSourceEventType = info->mCurTraceSourceType;
   mParentTaskId = info->mCurTaskId;
   mIsTraceInfoInit = true;
 }
 
 void
 TracedTaskCommon::DispatchTask(int aDelayTimeMs)