platform_system_core/debuggerd
Jinguang Dong 8ac2f27cc2 tombstoned: fixed tombstones failed issue
There is a problem about tombstone, which it will fail to
generate tombstone file in some scenarios due to socket
communication exception.

Reproduce step:
step 1: reboot device
step 2: ps -ef |grep zygote , get the pid of zygote64
(Attention: zygote64 should never been killed or reboot,
otherwise we can get the tombstone file)
step 3: kill -5 pid of zygote64
step 4: cd data/tombstones/, and could not find the tombstone
file of zygote64.

[Cause Analysis]
1. There are following logs by logcat:
11-19 15:38:43.789   569   569 F libc : Fatal signal 5 (SIGTRAP),
code 0 (SI_USER) in tid 569 (main), pid 569 (main)
11-19 15:38:43.829  6115  6115 I crash_dump64: obtaining output
fd from tombstoned, type: kDebuggerdTombstone
11-19 15:38:43.830   569  5836 I Zygote  : Process 6114 exited
cleanly (0)
11-19 15:38:43.830   777   777 I /system/bin/tombstoned: received
crash request for pid 569
11-19 15:38:43.831  6115  6115 I crash_dump64: performing dump of
process 569 (target tid = 569)
...
11-19 15:38:43.937   777   777 W /system/bin/tombstoned: crash
socket received short read of length 0 (expected 12)
2. The last log was print by function of crash_request_cb in
file of tombstoned.cpp, following related code:
  rc = TEMP_FAILURE_RETRY(read(sockfd, &request, sizeof(request)));
  if (rc == -1) {
    PLOG(WARNING) << "failed to read from crash socket";
    goto fail;
  } else if (rc != sizeof(request)) {
    LOG(WARNING) << "crash socket received short read of length " << rc << " (expected "
                 << sizeof(request) << ")";
    goto fail;
  }

Tombstoned read message by socket, and now the message length is
zero. Some socket communication exception occurs at that time.
We try to let crash_dump resend the socket message when the
communication is abnormal. Just as this CL.

Test: 1 reboot device
      2 ps -ef |grep zygote , get the pid of zygote64
       (Attention: zygote64 should never been killed or reboot,
       otherwise we can get the tombstone file)
      3 kill -5 pid of zygote64
      4 cd data/tombstones/, and could find the tombstone file of
       zygote64.

Change-Id: Ic152b081024d6c12f757927079fd221b63445b18
2018-11-28 14:00:27 +08:00
..
client debuggerd_client: improve error logging. 2018-09-06 13:00:57 -07:00
common/include tombstoned: allow intercepts for java traces. 2017-05-31 10:35:32 +01:00
crasher Fix two clang-tidy issues in crasher.cpp. 2018-09-24 13:18:22 -07:00
handler debuggerd_fallback: fix fd leak. 2018-10-30 15:33:58 -07:00
include/debuggerd tombstoned: allow intercepts for java traces. 2017-05-31 10:35:32 +01:00
libdebuggerd switch to using android-base/file.h instead of android-base/test_utils.h 2018-11-14 09:35:34 -08:00
seccomp_policy debuggerd seccomp: explain why we define PROT_READ/WRITE. 2018-02-18 23:50:19 -08:00
tombstoned tombstoned: don't generate tombstones for native backtraces. 2018-09-14 14:06:47 -07:00
.clang-format Remove extraneous .clang-format files 2017-03-14 14:06:31 -07:00
Android.bp libdebuggerd: extract and print the fdsan table. 2018-08-06 18:50:10 -07:00
Android.mk Mark crash_dump.policy as not supported on mips 2018-02-27 15:35:11 -08:00
crash_dump.cpp tombstoned: fixed tombstones failed issue 2018-11-28 14:00:27 +08:00
debuggerd.cpp debuggerd: add support for Java traces. 2018-06-14 15:40:06 -07:00
debuggerd_benchmark.cpp debuggerd: add pause time benchmark. 2017-12-19 16:36:04 -08:00
debuggerd_test.cpp tombstoned: don't generate tombstones for native backtraces. 2018-09-14 14:06:47 -07:00
MODULE_LICENSE_APACHE2 auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
OWNERS Add OWNERS. 2017-12-07 13:30:03 -08:00
protocol.h crash_dump: pass the address of the fdsan table. 2018-08-06 18:50:10 -07:00
util.cpp crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00
util.h crash_dump: fork a copy of the target's address space. 2017-12-15 14:11:12 -08:00