summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hans Boehm <hboehm@google.com> 2025-02-13 12:41:22 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-02-13 12:41:22 -0800
commitf9bdbb4e5d00b282a5ce1efdded57cfaa282de75 (patch)
treed98ba09c3026189b892df941de1a99e48b8dfa5b
parent89221d2022d034a47881dacbff913092915474b9 (diff)
parent6c0055968622ce3bc39745e3ab7f259427c10cc2 (diff)
Double suspend timeouts for user builds am: 0b5b2f22f2 am: 6c00559686
Original change: https://android-review.googlesource.com/c/platform/art/+/3490330 Change-Id: If7f5aca09d9f84f4965857e54626bc07d793d98a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--runtime/thread_list.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index b4f79ee5a8..6cc526a59f 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -28,6 +28,7 @@
#include <tuple>
#include <vector>
+#include "android-base/properties.h"
#include "android-base/stringprintf.h"
#include "art_field-inl.h"
#include "base/aborting.h"
@@ -765,13 +766,21 @@ static bool WaitOnceForSuspendBarrier(AtomicInteger* barrier,
std::optional<std::string> ThreadList::WaitForSuspendBarrier(AtomicInteger* barrier,
pid_t t,
int attempt_of_4) {
- // Only fail after kIter timeouts, to make us robust against app freezing.
#if ART_USE_FUTEXES
const uint64_t start_time = NanoTime();
#endif
uint64_t timeout_ns =
attempt_of_4 == 0 ? thread_suspend_timeout_ns_ : thread_suspend_timeout_ns_ / 4;
-
+ static bool is_user_build = (android::base::GetProperty("ro.build.type", "") == "user");
+ // Significantly increase timeouts in user builds, since they result in crashes.
+ // Many of these are likely to turn into ANRs, which are less informative for the developer, but
+ // friendlier to the user. We do not completely suppress timeouts, so that we avoid invisible
+ // problems for cases not covered by ANR detection, e.g. a problem in a clean-up daemon.
+ if (is_user_build) {
+ static constexpr int USER_MULTIPLIER = 2; // Start out small, perhaps increase later if we
+ // still have an issue?
+ timeout_ns *= USER_MULTIPLIER;
+ }
uint64_t avg_wait_multiplier = 1;
uint64_t wait_multiplier = 1;
if (attempt_of_4 != 1) {
@@ -819,6 +828,7 @@ std::optional<std::string> ThreadList::WaitForSuspendBarrier(AtomicInteger* barr
LOG(WARNING) << "Thread suspension nearly timed out due to Tracing stop (debugger attached?)";
timeout_ns = kTracingWaitNSecs;
}
+ // Only fail after kSuspendBarrierIters timeouts, to make us robust against app freezing.
while (i < kSuspendBarrierIters) {
if (WaitOnceForSuspendBarrier(barrier, cur_val, timeout_ns + dump_adjustment_ns)) {
++i;