Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH 3/3] daemon.c: make sure kill_some_child() really kills somebody

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:13
Subsystem: the rest · Maintainer: Linus Torvalds

We used to kill nobody if there is no existing connection from the same
address the new connection we are trying to handle, and dropped the new
connection.  Make sure we at least kill one.

Signed-off-by: Junio C Hamano <redacted>
---
 * I am not sure about this one, but it may be more in spirit with the old
   behaviour that made sure at max connection limit we killed some to
   handle new ones.

   Actually I do think this is probably a bad idea.  What we really want
   to do is to detect an old one that is not making any progress instead.
   "old" we can detect by looking at its position in the queue (or we
   could even add an explicit timestamp to the child structure), but it is
   harder to measure "not making any progress", especially without going
   too platform specific, e.g. monitoring rusage or somesuch, which we
   would want to avoid.

 daemon.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/daemon.c b/daemon.c
index 8d2755a..a0d8f65 100644
--- a/daemon.c
+++ b/daemon.c
@@ -641,8 +641,11 @@ static void kill_some_child(void)
 		if (!memcmp(&blanket->address, &next->address,
 			    sizeof(next->address))) {
 			kill(blanket->pid, SIGTERM);
-			break;
+			return;
 		}
+
+	/* Nobody from the same address?  Kill the youngest one, then. */
+	kill(firstborn->pid, SIGTERM);
 }
 
 static void check_dead_children(void)
-- 
1.6.0.129.ge10d2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help