summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/dumpstate.cpp
diff options
context:
space:
mode:
author Felipe Leme <felipeal@google.com> 2016-03-23 09:50:11 -0700
committer Felipe Leme <felipeal@google.com> 2016-03-23 10:39:10 -0700
commitb0133cdeaa98afa55249546f68b6167f1dde65b8 (patch)
tree02bd4a92dd53f3d3f4ff265e1baf2cb453656cd0 /cmds/dumpstate/dumpstate.cpp
parent5b817549fcea6f58bbeaaffbf654ddd8751ebbdc (diff)
Handled failure of execvp and increases am timeout.
The run_command_always() call fork and runs the command in the child code, and user to have the above logic: if (pid == 0) { // boiling code execvp(command, (char**) args); // execvp's result will be handled after waitpid_with_timeout() below... _exit(-1); // ...but it doesn't hurt to force exit, just in case } Recently, the _exit(-1) line was removed and there's been reports of dumpstate hanging after, because it tries to wait for pid 0 to finish (and in some cases it even tries to kill it). Also increased the timeout when running am to send broadcasts. BUG: 27804637 BUG: 27809534 Change-Id: Ia129253e367e5886d305947e56a643fd660a33bd
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
-rw-r--r--cmds/dumpstate/dumpstate.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index b391d76e2f..604aea687c 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -198,6 +198,9 @@ static void dump_systrace() {
// The drawback of calling execl directly is that we're not timing out if it hangs.
MYLOGD("Running '/system/bin/atrace --async_dump', which can take several seconds");
execl("/system/bin/atrace", "/system/bin/atrace", "--async_dump", nullptr);
+ // execl should never return, but it doesn't hurt to handle that scenario
+ MYLOGD("execl on '/system/bin/atrace --async_dump' returned control");
+ _exit(-1);
} else {
close(pipefd[1]); // close the write end of the pipe in the parent
add_zip_entry_from_fd("systrace.txt", pipefd[0]); // write output to zip file