Bug 1093098 - Don't get native stack before libs are loaded; r=snorp
authorJim Chen <nchen@mozilla.com>
Tue, 25 Nov 2014 15:01:33 -0800
changeset 241967 48e460577514322a0d6875230a75464bbec37fcb
parent 241803 ced1402861b8e0d0c59b42ba379281bd3a80926b
child 241968 a0664ef9c64f3845b4eff244014ed2ab73d573c7
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1093098
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1093098 - Don't get native stack before libs are loaded; r=snorp
mobile/android/base/ANRReporter.java
--- a/mobile/android/base/ANRReporter.java
+++ b/mobile/android/base/ANRReporter.java
@@ -466,19 +466,22 @@ public final class ANRReporter extends B
         ping.write(data);
         if (DEBUG) {
             Log.d(LOGTAG, "wrote ping footer, size = " + String.valueOf(data.length + total));
         }
     }
 
     private static void processTraces(Reader traces, File pingFile) {
 
-        // Unwinding is memory intensive; only unwind if we have enough memory
-        boolean haveNativeStack = requestNativeStack(
-            /* unwind */ SysInfo.getMemSize() >= 640);
+        // Only get native stack if Gecko is running.
+        // Also, unwinding is memory intensive, so only unwind if we have enough memory.
+        final boolean haveNativeStack =
+            GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning) ?
+            requestNativeStack(/* unwind */ SysInfo.getMemSize() >= 640) : false;
+
         try {
             OutputStream ping = new BufferedOutputStream(
                 new FileOutputStream(pingFile), TRACES_BLOCK_SIZE);
             try {
                 fillPingHeader(ping, pingFile.getName());
                 // Traces file has the format
                 //    ----- pid xxx at xxx -----
                 //    Cmd line: org.mozilla.xxx