Bug 1110499 - Don't exit crash handler on Android until we've finished started the reporter. r=ted, r=blassey, a=lmandel
authorJames Willcox <snorp@snorp.net>
Mon, 15 Dec 2014 12:13:12 -0600
changeset 234379 7660acc7c6d3c68594c3a03cad86c74cebfb8165
parent 234378 38b6a6ad812a2b1d4756c1961bb002569b171fe3
child 234380 3a51fc9b58687f156246ffa0b35dbadcd6648d69
push id7375
push userryanvm@gmail.com
push dateWed, 17 Dec 2014 15:59:40 +0000
treeherdermozilla-aurora@3a51fc9b5868 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, blassey, lmandel
bugs1110499
milestone36.0a2
Bug 1110499 - Don't exit crash handler on Android until we've finished started the reporter. r=ted, r=blassey, a=lmandel
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