From bafc286086c61007b7af1b0ed29d64fea31dc32a Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 9 Nov 2004 18:40:00 +0000
Subject: [PATCH] slurmd to always give jobs KillWait time between SIGTERM and
 SIGKILL     at termination

---
 NEWS             | 4 ++++
 src/slurmd/req.c | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index dd8b735e773..aea5687c30d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ documents those changes that are of interest to users and admins.
 
 * Changes in SLURM 0.4.0-pre5
 =============================
+ -- select/bluegene plugin confirms db.properties file in $sysconfdir
+    and copies it to StateSaveLocation (slurmctld's working directory)
+ -- slurmd to always give jobs KillWait time between SIGTERM and SIGKILL
+    at termination
 
 * Changes in SLURM 0.4.0-pre4
 =============================
diff --git a/src/slurmd/req.c b/src/slurmd/req.c
index de5564069cb..27b790d9065 100644
--- a/src/slurmd/req.c
+++ b/src/slurmd/req.c
@@ -713,7 +713,8 @@ _rpc_timelimit(slurm_msg_t *msg, slurm_addr *cli_addr)
 	/*
 	 * Check to see if any processes are still around
 	 */
-	if ((nsteps > 0) && _job_still_running(req->job_id)) {
+	if ((nsteps > 0) && _job_still_running(req->job_id)
+	&&  (conf->cf.kill_wait > 1)) {
 		verbose( "Job %u: waiting %d secs for SIGKILL", 
 			 req->job_id, conf->cf.kill_wait       );
 		sleep (conf->cf.kill_wait - 1);
@@ -964,6 +965,7 @@ _rpc_kill_job(slurm_msg_t *msg, slurm_addr *cli)
 	kill_job_msg_t *req    = msg->data;
 	uid_t           uid    = g_slurm_auth_get_uid(msg->cred);
 	int             nsteps = 0;
+	int		delay;
 
 	/* 
 	 * check that requesting user ID is the SLURM UID
@@ -1032,7 +1034,8 @@ _rpc_kill_job(slurm_msg_t *msg, slurm_addr *cli)
 	/*
 	 *  Check for corpses
 	 */
-	if ( !_pause_for_job_completion (req->job_id, 5)
+	delay = MAX(conf->cf.kill_wait, 5);
+	if ( !_pause_for_job_completion (req->job_id, delay)
 	   && _kill_all_active_steps(req->job_id, SIGKILL, true) ) {
 		/*
 		 *  Block until all user processes are complete.
-- 
GitLab