summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Gao2017-12-20 17:34:35 -0600
committerJosh Gao2017-12-22 16:20:12 -0600
commit7302097e776e037c5caedbc985dfff69fdac7d4d (patch)
tree3c160e62cfdee0f83ddb0a79430fea96db8a4242 /debuggerd
parent18f25d399e170b9944fd7eb23c48d88e51db45ce (diff)
downloadplatform-system-core-7302097e776e037c5caedbc985dfff69fdac7d4d.tar.gz
platform-system-core-7302097e776e037c5caedbc985dfff69fdac7d4d.tar.xz
platform-system-core-7302097e776e037c5caedbc985dfff69fdac7d4d.zip
debuggerd: wait for dump completion on crashes.
When a process crashes, both ActivityManager and init will try to kill its process group when they notice. The recent change to minimize the amount of time a process is paused results in crash dumps being killed before they finish as a result of this. Since anything that needs to be low-latency is probably not going to be too happy if it crashes, just wait for completion whenever we're processing a real crash. Bug: http://b/70343110 Test: debuggerd_test Change-Id: I894bb06efd264b1ba005df06f7326a72f4b767bb
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 02bc4b84f..96f3c7c54 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -395,9 +395,6 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
395 // crash_dump is ptracing us, fork off a copy of our address space for it to use. 395 // crash_dump is ptracing us, fork off a copy of our address space for it to use.
396 create_vm_process(); 396 create_vm_process();
397 397
398 input_read.reset();
399 input_write.reset();
400
401 // Don't leave a zombie child. 398 // Don't leave a zombie child.
402 int status; 399 int status;
403 if (TEMP_FAILURE_RETRY(waitpid(crash_dump_pid, &status, 0)) == -1) { 400 if (TEMP_FAILURE_RETRY(waitpid(crash_dump_pid, &status, 0)) == -1) {
@@ -406,6 +403,14 @@ static int debuggerd_dispatch_pseudothread(void* arg) {
406 } else if (WIFSTOPPED(status) || WIFSIGNALED(status)) { 403 } else if (WIFSTOPPED(status) || WIFSIGNALED(status)) {
407 async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped"); 404 async_safe_format_log(ANDROID_LOG_FATAL, "libc", "crash_dump helper crashed or stopped");
408 } 405 }
406
407 if (thread_info->siginfo->si_signo != DEBUGGER_SIGNAL) {
408 // For crashes, we don't need to minimize pause latency.
409 // Wait for the dump to complete before having the process exit, to avoid being murdered by
410 // ActivityManager or init.
411 TEMP_FAILURE_RETRY(read(input_read, &buf, sizeof(buf)));
412 }
413
409 return 0; 414 return 0;
410} 415}
411 416