From 185589ba6c6886d2e01502cdedd8a2593aeae133 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 27 Aug 2024 10:32:47 +0000 Subject: [PATCH] Revert "libhealthloop: Handle netlink receive buffer overflows" Revert this CL because there are several signs that too much time is spent in healthd and because CL "libhealthloop: Handle netlink receive buffer overflows" is suspected of causing an infinite loop. Bug: 359559224 Change-Id: Iaec132da47284d662b357b901b81b21fb6d7cd9e Signed-off-by: Bart Van Assche --- health/utils/libhealthloop/HealthLoop.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/health/utils/libhealthloop/HealthLoop.cpp b/health/utils/libhealthloop/HealthLoop.cpp index f8c3490cbe..ba7e75aa3d 100644 --- a/health/utils/libhealthloop/HealthLoop.cpp +++ b/health/utils/libhealthloop/HealthLoop.cpp @@ -57,13 +57,14 @@ int HealthLoop::RegisterEvent(int fd, BoundFunction func, EventWakeup wakeup) { EventHandler{this, fd, std::move(func)})) .get(); - struct epoll_event ev = { - .events = EPOLLIN | EPOLLERR, - .data.ptr = reinterpret_cast(event_handler), - }; + struct epoll_event ev; + + ev.events = EPOLLIN; if (wakeup == EVENT_WAKEUP_FD) ev.events |= EPOLLWAKEUP; + ev.data.ptr = reinterpret_cast(event_handler); + if (epoll_ctl(epollfd_, EPOLL_CTL_ADD, fd, &ev) == -1) { KLOG_ERROR(LOG_TAG, "epoll_ctl failed; errno=%d\n", errno); return -1; @@ -118,15 +119,9 @@ void HealthLoop::PeriodicChores() { // TODO(b/140330870): Use BPF instead. #define UEVENT_MSG_LEN 2048 -void HealthLoop::UeventEvent(uint32_t epevents) { +void HealthLoop::UeventEvent(uint32_t /*epevents*/) { // No need to lock because uevent_fd_ is guaranteed to be initialized. - if (epevents & EPOLLERR) { - // The netlink receive buffer overflowed. - ScheduleBatteryUpdate(); - return; - } - char msg[UEVENT_MSG_LEN + 2]; char* cp; int n;