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

[PATCH 4/5] fetch-pack: isolate sigpipe in demuxer thread

From
Jeff King <peff@peff.net>
Date
Apr 19, 2016, 22:50 UTC
Message-ID
<20160419225029.GD18255@sigill.intra.peff.net>
In-Reply-To
<20160419223945.GA18055@sigill.intra.peff.net>

In commit 9ff18fa (fetch-pack: ignore SIGPIPE in sideband demuxer, 2016-02-24), we started using sigchain_push() to ignore SIGPIPE in the async demuxer thread. However, this is rather clumsy, as it ignores SIGPIPE for the entire process, including the main thread. At the time we didn't have any per-thread signal support, but we now we do. Let's use it.

Signed-off-by: Jeff King <peff@peff.net>
---
 fetch-pack.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index f96f6df..b501d5c 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -15,7 +15,6 @@
 #include "version.h"
 #include "prio-queue.h"
 #include "sha1-array.h"
-#include "sigchain.h"
 
 static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
@@ -674,10 +673,8 @@ static int sideband_demux(int in, int out, void *data)
 	int *xd = data;
 	int ret;
 
-	sigchain_push(SIGPIPE, SIG_IGN);
 	ret = recv_sideband("fetch-pack", xd[0], out);
 	close(out);
-	sigchain_pop(SIGPIPE);
 	return ret;
 }
 
@@ -701,6 +698,7 @@ static int get_pack(struct fetch_pack_args *args,
 		demux.proc = sideband_demux;
 		demux.data = xd;
 		demux.out = -1;
+		demux.isolate_sigpipe = 1;
 		if (start_async(&demux))
 			die("fetch-pack: unable to fork off sideband"
 			    " demultiplexer");
-- 
2.8.1.512.g4e0a533
Previous: Jeff KingNext: Jeff King
Message 7 of 10 in “fix deadlock in git-push”
  1. 0/5 fix deadlock in git-pushJeff King, Apr 19, 2016
  2. 1/5 send-pack: close demux pipe before finishing async processJeff King, Apr 19, 2016
  3. 2/5 run-command: teach async threads to ignore SIGPIPEJeff King, Apr 19, 2016
  4. Johannes SixtApr 21, 2016
  5. Jeff KingApr 21, 2016
  6. 3/5 send-pack: isolate sigpipe in demuxer threadJeff King, Apr 19, 2016
  7. 4/5 fetch-pack: isolate sigpipe in demuxer threadJeff King, Apr 19, 2016
  8. 5/5 t5504: drop sigpipe=ok from push testsJeff King, Apr 19, 2016
  9. Junio C HamanoApr 20, 2016
  10. Jeff KingApr 20, 2016

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.