diff --git a/platform/src/watchdog_tfe.cpp b/platform/src/watchdog_tfe.cpp index 9cbbee6..a1768e5 100644 --- a/platform/src/watchdog_tfe.cpp +++ b/platform/src/watchdog_tfe.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,7 @@ static void watchdog_tfe_thread_handle(evutil_socket_t fd, short what, void *arg struct watchdog_tfe *__ctx = proxy->watchdog_tfe; struct timespec now; time_t temp; + const char *check_result = "WATCHDOG=1"; clock_gettime(CLOCK_MONOTONIC, &now); @@ -80,13 +82,18 @@ static void watchdog_tfe_thread_handle(evutil_socket_t fd, short what, void *arg now.tv_sec, proxy->work_threads[i]->thread_id, proxy->work_threads[i]->readable_tid, temp, __ctx->cur_time_window_fail_cnt); if (__ctx->cur_time_window_fail_cnt >= __ctx->timeout_cnt_as_fail) { - TFE_LOG_ERROR(__ctx->logger, "Frome %ld to %ld, there are %d timeouts of the worker threads, Exit !!!", + TFE_LOG_ERROR(__ctx->logger, "Frome %ld to %ld, there are %d timeouts of the worker threads, Ready to Exit !!!", __ctx->cur_time_window_begin, __ctx->cur_time_window_end, __ctx->cur_time_window_fail_cnt); - exit(-1); + check_result = "WATCHDOG=trigger"; } } } } + + if (sd_watchdog_enabled(0, NULL)) + { + sd_notify(0, check_result); + } } struct watchdog_tfe *watchdog_tfe_create(struct tfe_proxy *proxy, const char *profile, void *logger) diff --git a/script/service/tfe.service b/script/service/tfe.service index ec19e52..0f02cb7 100644 --- a/script/service/tfe.service +++ b/script/service/tfe.service @@ -17,6 +17,7 @@ LimitCORE=infinity TasksMax=infinity Delegate=yes KillMode=process +WatchdogSec=10s [Install] WantedBy=multi-user.target