From 96e7f23642e3cf2b4ef987b10bedc779b60dee96 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 8 Oct 2007 17:44:23 +0000
Subject: [PATCH] svn merge -r12460:12462
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.2

---
 NEWS                  | 2 ++
 src/slurmctld/agent.c | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index db408bb502c..7a83c84e0cf 100644
--- a/NEWS
+++ b/NEWS
@@ -89,6 +89,8 @@ documents those changes that are of interest to users and admins.
     job submissions are unable to set the proper environment variables.
  -- Fix problem in parallel make of Slurm.
  -- Fixed bug in consumable resources when CR_Core_Memory is enabled
+ -- Add delay in slurmctld for "scontrol shutdown" RPC to get propagated 
+    to slurmd daemons.
 
 * Changes in SLURM 1.2.17
 =========================
diff --git a/src/slurmctld/agent.c b/src/slurmctld/agent.c
index 27f9c2e5f02..909324b1505 100644
--- a/src/slurmctld/agent.c
+++ b/src/slurmctld/agent.c
@@ -1191,8 +1191,7 @@ void agent_queue_request(agent_arg_t *agent_arg_ptr)
 {
 	queued_request_t *queued_req_ptr = NULL;
 
-	if ((agent_cnt < MAX_AGENT_CNT) ||		/* execute now */
-	    (agent_arg_ptr->msg_type == REQUEST_SHUTDOWN)) {
+	if (agent_arg_ptr->msg_type == REQUEST_SHUTDOWN) { /* execute now */
 		pthread_attr_t attr_agent;
 		pthread_t thread_agent;
 		int rc;
@@ -1203,8 +1202,12 @@ void agent_queue_request(agent_arg_t *agent_arg_ptr)
 		rc = pthread_create(&thread_agent, &attr_agent,
 				    agent, (void *) agent_arg_ptr);
 		slurm_attr_destroy(&attr_agent);
-		if (rc == 0)
+		if (rc == 0) {
+			sleep(1);
+			if (!pthread_kill(thread_agent, 0))
+				info("Shutdown agent still running");
 			return;
+		}
 	}
 
 	queued_req_ptr = xmalloc(sizeof(queued_request_t));
-- 
GitLab