代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 9315c29e4fdfa19c90bb483a364b017881f5cef7 Mon Sep 17 00:00:00 2001
From: huangkaibin <huangkaibin@huawei.com>
Date: Sat, 21 Apr 2018 17:18:19 +0800
Subject: [PATCH] systemd-core: Delay to restart when a service can not be
auto-restarted when there is one STOP_JOB for the service
When a service current has a STOP job has not scheduled yet,
and also if the service is already scheduled with an auto-restart
with restart-second configured as 0, the service will not be restarted successfully,
and systemd will go into an endless loop to restart the service.
This is because restart-second is 0 and timer task has higher priority than IO tasks when there priority
is same(both with 0), so the STOP job has no chance to be scheduled, and systemd will go into the endless loop
to handle the time task.
This patch fix this problem by delaying 1 second to restart the service to cause STOP job to be scheduled.
---
src/core/service.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/core/service.c b/src/core/service.c
index e368ec8..9b4b5b1 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -2262,13 +2262,17 @@ fail:
static void service_enter_restart(Service *s) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
int r;
+ int restart_usec;
assert(s);
if (unit_has_job_type(UNIT(s), JOB_STOP)) {
/* Don't restart things if we are going down anyway */
log_unit_info(UNIT(s), "Stop job pending for unit, skipping automatic restart.");
- return;
+ restart_usec = (s->restart_usec == 0) ? 1*USEC_PER_SEC : s->restart_usec;
+ r = service_arm_timer(s, /* relative= */ false, usec_add(now(CLOCK_MONOTONIC), restart_usec));
+ if (r < 0)
+ goto fail;
}
/* Any units that are bound to this service must also be
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。