• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisãoe6784dcee14eaa54bafb49a6e495b670827076b8 (tree)
Hora2016-09-02 02:58:54
AutorLinux Build Service Account <lnxbuild@loca...>
CommiterLinux Build Service Account

Mensagem de Log

Promotion of android-framework.lnx.2.0-00005.

CRs Change ID Subject


1054828 I754f912c409fdf29f427b11763927405fbf877b4 debuggerd: Set timeout on native proc trace collection

Change-Id: I4f77ff306772f0a614cd6325a557d17deac81de2
CRs-Fixed: 1054828

Mudança Sumário

Diff

--- a/debuggerd/debuggerd.cpp
+++ b/debuggerd/debuggerd.cpp
@@ -671,7 +671,8 @@ static void worker_process(int fd, debugger_request_t& request) {
671671 }
672672
673673 static void monitor_worker_process(int child_pid, const debugger_request_t& request) {
674- struct timespec timeout = {.tv_sec = 10, .tv_nsec = 0 };
674+ // set the timeout to 3 sec, for trace collection
675+ struct timespec timeout = {.tv_sec = 3, .tv_nsec = 0 };
675676 if (should_attach_gdb(request)) {
676677 // If wait_for_gdb is enabled, set the timeout to something large.
677678 timeout.tv_sec = INT_MAX;
--- a/libcutils/debugger.c
+++ b/libcutils/debugger.c
@@ -76,7 +76,9 @@ static int make_dump_request(debugger_action_t action, pid_t tid, int timeout_se
7676 }
7777
7878 int dump_backtrace_to_file(pid_t tid, int fd) {
79- return dump_backtrace_to_file_timeout(tid, fd, 0);
79+ // Kind of a hack;
80+ // Use a timeout of 5 seconds for a given native proc
81+ return dump_backtrace_to_file_timeout(tid, fd, 5);
8082 }
8183
8284 int dump_backtrace_to_file_timeout(pid_t tid, int fd, int timeout_secs) {
@@ -89,13 +91,23 @@ int dump_backtrace_to_file_timeout(pid_t tid, int fd, int timeout_secs) {
8991 int result = 0;
9092 char buffer[1024];
9193 ssize_t n;
94+ int flag = 0;
95+
9296 while ((n = TEMP_FAILURE_RETRY(read(sock_fd, buffer, sizeof(buffer)))) > 0) {
97+ flag = 1;
9398 if (TEMP_FAILURE_RETRY(write(fd, buffer, n)) != n) {
9499 result = -1;
95100 break;
96101 }
97102 }
98103 close(sock_fd);
104+
105+ if (flag == 0) {
106+ ALOGE("Not even a single byte was read from debuggerd, for pid: %d", tid);
107+ }
108+ if (result == -1) {
109+ ALOGE("Failure(probably timeout) while reading data from debuggerd, for pid: %d", tid);
110+ }
99111 return result;
100112 }
101113