summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShrinidhi Hegde <shrinidhihegde@google.com>2024-04-04 16:25:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-04 16:25:43 +0000
commit9261e262cb9a7fd3f04b854c20a8023560389030 (patch)
tree064e55b24646ab2cceba979e6e81b98fb339a8a3
parentbf332686958bfd59c773a2a8ff18c89e9c40d33b (diff)
parent1d928ca80b8a620374d9e21f17aba96664febef0 (diff)
downloadcore-9261e262cb9a7fd3f04b854c20a8023560389030.tar.gz
Merge "Update native watchdog to be triggered after 20 restarts instead of 4." into main
-rw-r--r--init/service.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/init/service.cpp b/init/service.cpp
index eb24dd593..9ffab2618 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -352,14 +352,19 @@ void Service::Reap(const siginfo_t& siginfo) {
}
#endif
- // If we crash > 4 times in 'fatal_crash_window_' minutes or before boot_completed,
+ // If we crash > 20 times in 'fatal_crash_window_' minutes or before boot_completed,
// reboot into bootloader or set crashing property
+ // Wait for 20 crashes so RescueParty has a chance to perform the
+ // mitigations. RescueParty finishes all its mitigations at 15 system_server
+ // restarts. If it is still crashing after all rescue party mitigations,
+ // reboot into bootloader.
+ constexpr int crash_count_threshold = 20;
boot_clock::time_point now = boot_clock::now();
if (((flags_ & SVC_CRITICAL) || is_process_updatable) && !(flags_ & SVC_RESTART) &&
!was_last_exit_ok_) {
bool boot_completed = GetBoolProperty("sys.boot_completed", false);
if (now < time_crashed_ + fatal_crash_window_ || !boot_completed) {
- if (++crash_count_ > 4) {
+ if (++crash_count_ > crash_count_threshold) {
auto exit_reason = boot_completed ?
"in " + std::to_string(fatal_crash_window_.count()) + " minutes" :
"before boot completed";