aboutsummaryrefslogtreecommitdiff
path: root/cpp/watchdog
diff options
context:
space:
mode:
authorEric Jeong <ericjeong@google.com>2021-07-15 18:01:47 -0700
committerEric Jeong <ericjeong@google.com>2021-07-15 18:05:32 -0700
commite3af0fe57e25c9070638340888327e8c770ccb31 (patch)
treedbf8803a2adebd36df965692b27be20da040c09f /cpp/watchdog
parenta56ae95c03deded36bc937d061f974c08666c131 (diff)
downloadCar-e3af0fe57e25c9070638340888327e8c770ccb31.tar.gz
Loose timeout for car watchdog ANR
- On emulator, VHAL is killed by car watchdog sometime because VHAL is not able to generate heartbeat on time due to emulator's low performance. - We are going to add a configurable setting to control timeout per device(b/193742550), but as a temporary solution we increase the timeout to 6s for all devices. Bug: 193263201 Test: make sure emulator VHAL is not crashed at boot phase Change-Id: I78a2f08c147fa69cc5e54edbdddfa8500c90f70f
Diffstat (limited to 'cpp/watchdog')
-rw-r--r--cpp/watchdog/server/src/WatchdogProcessService.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpp/watchdog/server/src/WatchdogProcessService.cpp b/cpp/watchdog/server/src/WatchdogProcessService.cpp
index 97a4047531..fca1174406 100644
--- a/cpp/watchdog/server/src/WatchdogProcessService.cpp
+++ b/cpp/watchdog/server/src/WatchdogProcessService.cpp
@@ -83,10 +83,11 @@ const std::vector<TimeoutLength> kTimeouts = {TimeoutLength::TIMEOUT_CRITICAL,
const int32_t MSG_VHAL_WATCHDOG_ALIVE = static_cast<int>(TimeoutLength::TIMEOUT_NORMAL) + 1;
const int32_t MSG_VHAL_HEALTH_CHECK = MSG_VHAL_WATCHDOG_ALIVE + 1;
-// VHAL sends heart beat every 3s. Car watchdog checks if there is the latest heart beat from VHAL
+// TODO(b/193742550): Restore the timeout to 3s after configuration by vendors is added.
+// VHAL sends heart beat every 6s. Car watchdog checks if there is the latest heart beat from VHAL
// with 1s marginal time.
-constexpr std::chrono::nanoseconds kVhalHealthCheckDelayNs = 4s;
-constexpr int64_t kVhalHeartBeatIntervalMs = 3000;
+constexpr std::chrono::milliseconds kVhalHeartBeatIntervalMs = 6s;
+constexpr std::chrono::nanoseconds kVhalHealthCheckDelayNs = kVhalHeartBeatIntervalMs + 1s;
constexpr const char kServiceName[] = "WatchdogProcessService";
constexpr const char kVhalInterfaceName[] = "android.hardware.automotive.vehicle@2.0::IVehicle";
@@ -799,7 +800,7 @@ void WatchdogProcessService::checkVhalHealth() {
Mutex::Autolock lock(mMutex);
lastEventTime = mVhalHeartBeat.eventTime;
}
- if (currentUptime > lastEventTime + kVhalHeartBeatIntervalMs) {
+ if (currentUptime > lastEventTime + kVhalHeartBeatIntervalMs.count()) {
ALOGW("VHAL failed to update heart beat within timeout. Terminating VHAL...");
terminateVhal();
}