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
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 89c9653..d07ca8c 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -737,6 +737,8 @@
execvp(command, (char**) args);
// execvp's result will be handled after waitpid_with_timeout() below...
+ MYLOGD("execvp on command %s (plus args) returned control; calling _exit(-1)", command)
+ _exit(-1); // ...but it doesn't hurt to force exit, just in case
}
/* handle parent case */
@@ -848,7 +850,7 @@
std::string args_string;
format_args(am_index + 1, am_args, &args_string);
MYLOGD("send_broadcast command: %s\n", args_string.c_str());
- run_command_always(NULL, 5, true, am_args);
+ run_command_always(NULL, 20, true, am_args);
}
size_t num_props = 0;