From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BCD181396D9 for ; Thu, 26 Oct 2017 18:58:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1D43AE0C01; Thu, 26 Oct 2017 18:58:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F238EE0C01 for ; Thu, 26 Oct 2017 18:58:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3E91E33C770 for ; Thu, 26 Oct 2017 18:58:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 04366309 for ; Thu, 26 Oct 2017 18:58:26 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1508984355.35b88fb42bb8e0a56cdc1947342f1b89c98658bc.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/rc-cgroup.sh.in X-VCS-Directories: sh/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 35b88fb42bb8e0a56cdc1947342f1b89c98658bc X-VCS-Branch: master Date: Thu, 26 Oct 2017 18:58:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 10901c5f-4433-4de3-9df8-1cf694ccefc3 X-Archives-Hash: 6eb8e4f6393b901e7036b367be623153 commit: 35b88fb42bb8e0a56cdc1947342f1b89c98658bc Author: Patrick McLean gentoo org> AuthorDate: Thu Oct 26 02:19:15 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Oct 26 02:19:15 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=35b88fb4 cgroups_cleanup: clean up shutdown signaling - do not sleep for the full 90 seconds if processes are dead - re-arrange the order of signals we attempt to send to the processes sh/rc-cgroup.sh.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in index d48957ac..5bc7db54 100644 --- a/sh/rc-cgroup.sh.in +++ b/sh/rc-cgroup.sh.in @@ -203,15 +203,21 @@ cgroup_cleanup() { cgroup_running || return 0 ebegin "starting cgroups cleanup" - local pids + local pids loops=0 pids="$(cgroup_get_pids)" if [ -n "${pids}" ]; then - kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null kill -s CONT ${pids} 2> /dev/null + kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null yesno "${rc_send_sighup:-no}" && kill -s HUP ${pids} 2> /dev/null - sleep "${rc_timeout_stopsec:-90}" - yesno "${rc_send_sigkill:-yes}" && + kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null + while [ -n "$(cgroup_get_pids)" ] && + [ "${loops}" -lt "${rc_timeout_stopsec:-90}" ]; do + loops=$((loops+1)) + sleep 1 + done + pids="$(cgroup_get_pids)" + [ -n "${pids}" ] && yesno "${rc_send_sigkill:-yes}" && kill -s KILL ${pids} 2> /dev/null fi cgroup2_remove