From 9dc4d75702b1ab78c067ecf5397b8330ef0d670b Mon Sep 17 00:00:00 2001 From: oh_ci Date: Mon, 19 May 2025 11:10:17 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!525?= =?UTF-8?q?=20:=20Add=20the=20maintenance=20and=20measurement=20informatio?= =?UTF-8?q?n=20of=20the=20TimeOut=20excepti=E2=80=A6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/src/timer_event_handler.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/base/src/timer_event_handler.cpp b/base/src/timer_event_handler.cpp index be6c1ab..75e7d41 100644 --- a/base/src/timer_event_handler.cpp +++ b/base/src/timer_event_handler.cpp @@ -98,17 +98,8 @@ void TimerEventHandler::TimeOut() uint64_t expirations = 0; ssize_t n = ::read(GetHandle(), &expirations, sizeof(expirations)); if (n != sizeof(expirations)) { - int erronRead = errno; - struct itimerspec current = { - .it_interval = {.tv_sec = -1, .tv_nsec = -1}, - .it_value = {.tv_sec = -1, .tv_nsec = -1} - }; - if (timerfd_gettime(GetHandle(), ¤t) == -1) { - UTILS_LOGE("timerfd_gettime failed, errno=%{public}d", errno); - } - UTILS_LOGE("epoll_loop::on_timer() reads %{public}d bytes instead of 8, timerFd=%{public}d, errno=%{public}d, " - "Current timer value: %{public}lld sec, %{public}ld nsec", static_cast(n), GetHandle(), - erronRead, current.it_value.tv_sec, current.it_value.tv_nsec); + UTILS_LOGE("epoll_loop::on_timer() reads %{public}d bytes instead of 8, errno=%{public}d", static_cast(n), + errno); } if (callback_) { callback_(GetHandle()); -- Gitee From e8ff00274bd5a6700f49a7e1c4199cceb08310da Mon Sep 17 00:00:00 2001 From: oh_ci Date: Mon, 19 May 2025 11:13:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Revert=20"=E5=9B=9E=E9=80=80=20'Pull=20Requ?= =?UTF-8?q?est=20!525=20:=20Add=20the=20maintenance=20and=20measurement=20?= =?UTF-8?q?informatio=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9dc4d75702b1ab78c067ecf5397b8330ef0d670b. --- base/src/timer_event_handler.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/base/src/timer_event_handler.cpp b/base/src/timer_event_handler.cpp index 75e7d41..be6c1ab 100644 --- a/base/src/timer_event_handler.cpp +++ b/base/src/timer_event_handler.cpp @@ -98,8 +98,17 @@ void TimerEventHandler::TimeOut() uint64_t expirations = 0; ssize_t n = ::read(GetHandle(), &expirations, sizeof(expirations)); if (n != sizeof(expirations)) { - UTILS_LOGE("epoll_loop::on_timer() reads %{public}d bytes instead of 8, errno=%{public}d", static_cast(n), - errno); + int erronRead = errno; + struct itimerspec current = { + .it_interval = {.tv_sec = -1, .tv_nsec = -1}, + .it_value = {.tv_sec = -1, .tv_nsec = -1} + }; + if (timerfd_gettime(GetHandle(), ¤t) == -1) { + UTILS_LOGE("timerfd_gettime failed, errno=%{public}d", errno); + } + UTILS_LOGE("epoll_loop::on_timer() reads %{public}d bytes instead of 8, timerFd=%{public}d, errno=%{public}d, " + "Current timer value: %{public}lld sec, %{public}ld nsec", static_cast(n), GetHandle(), + erronRead, current.it_value.tv_sec, current.it_value.tv_nsec); } if (callback_) { callback_(GetHandle()); -- Gitee