Bug 1110499 - Don't exit crash handler on Android until we've finished started the reporter r=ted,blassey
authorJames Willcox <snorp@snorp.net>
Mon, 15 Dec 2014 12:13:12 -0600
changeset 219920 14a3a1d0dd4052f0e5fa9767edc7d6f0051f3cab
parent 219919 24e7989527654f7d0e4103dbe97d3631dfa920f6
child 219921 bb5ab080b742f9c70499c683900ec7481dee4b46
push id52948
push userjwillcox@mozilla.com
push dateTue, 16 Dec 2014 14:42:43 +0000
treeherdermozilla-inbound@139e84c2fe81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, blassey
bugs1110499
milestone37.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 1110499 - Don't exit crash handler on Android until we've finished started the reporter r=ted,blassey
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -48,18 +48,20 @@
 #include "mac_utils.h"
 #elif defined(XP_LINUX)
 #include "nsIINIParser.h"
 #include "common/linux/linux_libc_support.h"
 #include "third_party/lss/linux_syscall_support.h"
 #include "client/linux/crash_generation/client_info.h"
 #include "client/linux/crash_generation/crash_generation_server.h"
 #include "client/linux/handler/exception_handler.h"
+#include "common/linux/eintr_wrapper.h"
 #include <fcntl.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <unistd.h>
 #elif defined(XP_SOLARIS)
 #include "client/solaris/handler/exception_handler.h"
 #include <fcntl.h>
 #include <sys/types.h>
 #include <unistd.h>
 #else
 #error "Not yet implemented for this platform"
@@ -951,16 +953,23 @@ bool MinidumpCallback(
                        "start",
                        "-a", "org.mozilla.gecko.reportCrash",
                        "-n", crashReporterPath,
                        "--es", "minidumpPath", minidumpPath,
                        (char*)0);
     }
 #endif
     _exit(1);
+#ifdef MOZ_WIDGET_ANDROID
+  } else {
+    // We need to wait on the 'am start' command above to finish, otherwise everything will
+    // be killed by the ActivityManager as soon as the signal handler exits
+    int status;
+    unused << HANDLE_EINTR(sys_waitpid(pid, &status, __WALL));
+#endif
   }
 #endif // XP_MACOSX
 #endif // XP_UNIX
 
   return returnValue;
 }
 
 #ifdef XP_WIN