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 227463 8e81c96d07495946c2bced18a28dca1f0b1b2ea2
parent 227462 d16b84a5d3989d7a819cdeed8f203141ac119f52
child 227464 ef19db469965168d18e7025da371b73867932917
child 227465 c02644846c0dac151719a0e4806798fe773a91f3
push id603
push userryanvm@gmail.com
push dateWed, 17 Dec 2014 16:03:27 +0000
treeherdermozilla-release@8e81c96d0749 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, blassey, lmandel
bugs1110499
milestone34.0
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
@@ -47,18 +47,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"
@@ -936,16 +938,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