[Android]: Fix hang in CreateChildCrash() on Android.

After r1299, the LinuxCoreDumperTest::VerifyDumpWithMultipleThreads and
ElfCoreDumpTest::ValidCoreFile would both hang on Android.  This appears to be due to the tkill
signal not being recieved by the thread which is meant to crash, even though tkill returns 0.
This CL retries sending the tkill signal multiple times, which prevents the Hang.

BUG=579
R=thestig@chromium.org

Review URL: https://breakpad.appspot.com/1524002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1313 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
rmcilroy@chromium.org 2014-04-15 10:07:50 +00:00
parent eebdc96430
commit 32031a9136

View File

@ -199,6 +199,11 @@ bool CrashGenerator::CreateChildCrash(
fprintf(stderr, "CrashGenerator: Failed to copy proc files\n");
exit(1);
}
// On Android the signal sometimes doesn't seem to get sent even though
// tkill returns '0'. Retry a couple of times if the signal doesn't get
// through on the first go:
// https://code.google.com/p/google-breakpad/issues/detail?id=579
for (int i = 0; i < 60; i++) {
if (tkill(*GetThreadIdPointer(crash_thread), crash_signal) == -1) {
perror("CrashGenerator: Failed to kill thread by signal");
} else {
@ -211,7 +216,8 @@ bool CrashGenerator::CreateChildCrash(
// really poll and wait for the kernel to declare the signal has been
// delivered. If it has, and things worked, we'd be killed, so the
// sleep length doesn't really matter.
sleep(10 * 60);
sleep(1);
}
}
} else {
perror("CrashGenerator: Failed to set core limit");