git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 24, 2008, 20:33 UTC
Message-ID
<7vk5e6kvaw.fsf_-_@gitster.siamese.dyndns.org>
In-Reply-To
<7vwsi6kvow.fsf@gitster.siamese.dyndns.org>

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 <gitster@pobox.com>
---
 * 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
Previous: Junio C HamanoNext: Stephen R. van den Berg
Message 8 of 11 in “What's cooking in git.git (Aug 2008, #07; Sat, 23)”
  1. Junio C HamanoAug 24, 2008
  2. Maintaining "needswork" section of "What's (not) cooking"Junio C Hamano, Aug 24, 2008
  3. Johannes SchindelinAug 24, 2008
  4. Junio C HamanoAug 24, 2008
  5. Junio C HamanoAug 24, 2008
  6. 1/3 daemon.c: minor style fixupJunio C Hamano, Aug 24, 2008
  7. 2/3 daemon.c: simplify add_child() and kill_some_child() logicJunio C Hamano, Aug 24, 2008
  8. 3/3 daemon.c: make sure kill_some_child() really kills somebodyJunio C Hamano, Aug 24, 2008
  9. Stephen R. van den BergAug 25, 2008
  10. Junio C HamanoAug 25, 2008
  11. Stephen R. van den BergAug 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.