summaryrefslogtreecommitdiff
path: root/debuggerd
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2024-03-21 16:56:07 -0700
committerPeter Collingbourne <pcc@google.com>2024-03-21 18:28:08 -0700
commit7285c0d1bbc55a94e48cff7dfbb90eec305ce6cf (patch)
tree40a2fb99bd171bd39f7557e9874c232a21359354 /debuggerd
parentd49456a11f2efc50d5496eab25548825489b9ac6 (diff)
downloadcore-7285c0d1bbc55a94e48cff7dfbb90eec305ce6cf.tar.gz
tombstoned: Rename proto tombstone before text tombstone.
Because the log message "Tombstone written to: $NAME" is written before renaming the proto tombstone, it is possible that a tool that automatically downloads new proto tombstones by watching for this log message will fail to download the tombstone. For the tool that I am developing, this occurs < 0.1% of the time. Fix the issue by renaming the proto tombstone first. Bug: 328531087 Change-Id: I5b751585f2fce897ca7eb76c0466a0c33a93d851
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/tombstoned/tombstoned.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/debuggerd/tombstoned/tombstoned.cpp b/debuggerd/tombstoned/tombstoned.cpp
index 75ae9f8a6..fa67d46e6 100644
--- a/debuggerd/tombstoned/tombstoned.cpp
+++ b/debuggerd/tombstoned/tombstoned.cpp
@@ -456,6 +456,14 @@ static void crash_completed(borrowed_fd sockfd, std::unique_ptr<Crash> crash) {
CrashArtifactPaths paths = queue->get_next_artifact_paths();
+ if (crash->output.proto && crash->output.proto->fd != -1) {
+ if (!paths.proto) {
+ LOG(ERROR) << "missing path for proto tombstone";
+ } else {
+ rename_tombstone_fd(crash->output.proto->fd, queue->dir_fd(), *paths.proto);
+ }
+ }
+
if (rename_tombstone_fd(crash->output.text.fd, queue->dir_fd(), paths.text)) {
if (crash->crash_type == kDebuggerdJavaBacktrace) {
LOG(ERROR) << "Traces for pid " << crash->crash_pid << " written to: " << paths.text;
@@ -466,14 +474,6 @@ static void crash_completed(borrowed_fd sockfd, std::unique_ptr<Crash> crash) {
LOG(ERROR) << "Tombstone written to: " << paths.text;
}
}
-
- if (crash->output.proto && crash->output.proto->fd != -1) {
- if (!paths.proto) {
- LOG(ERROR) << "missing path for proto tombstone";
- } else {
- rename_tombstone_fd(crash->output.proto->fd, queue->dir_fd(), *paths.proto);
- }
- }
}
static void crash_completed_cb(evutil_socket_t sockfd, short ev, void* arg) {