{"thread":{"id":"65640","subject":"[PATCH] connected: close err_fd in promisor fast-path","startedAt":"2026-05-15T06:39:57Z","lastAt":"2026-05-15T06:39:57Z","messageCount":1,"participants":["Ethan via GitGitGadget"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"543378","messageId":"pull.2303.git.git.1778827194448.gitgitgadget@gmail.com","threadId":"65640","inReplyTo":null,"subject":"[PATCH] connected: close err_fd in promisor fast-path","fromName":"Ethan via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-15T06:39:54Z","receivedAt":"2026-05-15T06:39:57Z","isPatch":true,"body":"From: Ethan Dickson <ethanndickson@gmail.com>\n\nconnected.h documents that err_fd is closed before check_connected()\nreturns. It is, on three of four exit paths. The promisor-pack fast\npath added in 50033772d (connected: verify promisor-ness of partial\nclone, 2020-01-30) returns 0 without closing it.\n\nreceive-pack uses err_fd as the write end of an async sideband\nmuxer's pipe, and the muxer thread waits for EOF. The same omission\nhas caused deadlocks there twice before: 49ecfa13f (receive-pack:\nclose sideband fd on early pack errors, 2013-04-19) and 6cdad1f13\n(receive-pack: fix deadlock when we cannot create tmpdir,\n2017-03-07).\n\nSigned-off-by: Ethan Dickson <ethanndickson@gmail.com>\n---\n    connected: close err_fd in promisor fast-path\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2303%2Fethanndickson%2Fconnected-close-err-fd-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2303/ethanndickson/connected-close-err-fd-v1\nPull-Request: https://github.com/git/git/pull/2303\n\n connected.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/connected.c b/connected.c\nindex 6718503649..7e26976832 100644\n--- a/connected.c\n+++ b/connected.c\n@@ -76,6 +76,8 @@ int check_connected(oid_iterate_fn fn, void *cb_data,\n promisor_pack_found:\n \t\t\t;\n \t\t} while ((oid = fn(cb_data)) != NULL);\n+\t\tif (opt->err_fd)\n+\t\t\tclose(opt->err_fd);\n \t\treturn 0;\n \t}\n \n\nbase-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0\n-- \ngitgitgadget\n"}]}