Bug 1401737 - 1. Add a diagnostic crash; r=me
authorJim Chen <nchen@mozilla.com>
Thu, 21 Sep 2017 23:41:22 -0400
changeset 382384 40023b79401d49e45e1eb53acb2b96976f24a939
parent 382383 14cf84cd05639c0bd7db54118102b1742e90cadf
child 382385 0b39d5cbf3d1cf23fc162fb8b4e9261cbb3d6521
push id32555
push userarchaeopteryx@coole-files.de
push dateFri, 22 Sep 2017 09:43:20 +0000
treeherdermozilla-central@82b2ae0b03ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1401737
milestone58.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 1401737 - 1. Add a diagnostic crash; r=me Add a diagnostic crash for the unexpected case where GeckoService.register() is called a second time. We know the stack for the second call, but we want to know the stack for the first call, so we introduce this intentional crash. r=me for trivial diagnostic patch which will be backed out ASAP. MozReview-Commit-ID: HobtPiVSSTR
mobile/android/base/java/org/mozilla/gecko/GeckoService.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
@@ -66,20 +66,32 @@ public class GeckoService extends Servic
             default:
                 throw new UnsupportedOperationException(event);
             }
         }
     }
 
     private static final EventListener EVENT_LISTENER = new EventListener();
 
+    private static RuntimeException bug1401737Diag;
+
     public static void register() {
         if (DEBUG) {
             Log.d(LOGTAG, "Registered listener");
         }
+
+        // Diagnose bug 1401737. register() is unexpectedly getting called a second time.
+        // We know the stack for the second call, but we want to collect stack for the first call.
+        if (bug1401737Diag == null) {
+            bug1401737Diag = new IllegalStateException("Bug 1401737 diagnostic crash");
+        } else {
+            Log.e(LOGTAG, "register() is called a second time", new Exception());
+            throw bug1401737Diag;
+        }
+
         EventDispatcher.getInstance().registerGeckoThreadListener(EVENT_LISTENER,
                 "Gecko:ScheduleRun");
     }
 
     public static void unregister() {
         if (DEBUG) {
             Log.d(LOGTAG, "Unregistered listener");
         }