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

Re: [PATCH] Fix bunch of fd leaks in http-fetch

From
NHNick Hengeveld <nickh@reactrix.com>
Date
Nov 12, 2005, 17:38 UTC
Message-ID
<20051112173828.GG4051@reactrix.com>
In-Reply-To
<7vk6feiflx.fsf@assigned-by-dhcp.cox.net>
On Fri, Nov 11, 2005 at 09:45:30PM -0800, Junio C Hamano wrote:
Show 7 quoted lines
> It strikes me somewhat odd that these close() are not tied to
> the lifetime rule of the transfer_request structure.  When the
> program falls back from an individual object to alternates, the
> same request structure is reused, but in that case ->local stays
> the same.  Otherwise, the original request structure is released
> so I wonder if would make things cleaner to close ->local inside
> request_release()...

That is the intent of the fd close in finish_request() - but that isn't called if the server returns a 404 and there are no alternates left to try.

The following patch should fix it.

Added a call to finish_request to clean up resources if the server returned a 404 and there are no alternates left to try.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
---
 http-fetch.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

applies-to: 8bae950cd42c1d615fafdf63f4c96f6b665f1e0e fe26837d08627fbb2f5f57879ebb573474680c4a

diff --git a/http-fetch.c b/http-fetch.c
index cbb9690..78becce 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -632,6 +632,8 @@ static void process_curl_messages(void)
 						request->repo =
 							request->repo->next;
 						start_request(request);
+					} else {
+						finish_request(request);
 					}
 				} else {
 					finish_request(request);
---
0.99.9.GIT
Previous: Junio C HamanoNext: Petr Baudis
Message 5 of 7 in “file descriptor leak? or expected behavior?”
  1. Becky BruceNov 11, 2005
  2. Becky BruceNov 11, 2005
  3. Fix bunch of fd leaks in http-fetchPetr Baudis, Nov 11, 2005
  4. Junio C HamanoNov 12, 2005
  5. Nick HengeveldNov 12, 2005
  6. Petr BaudisNov 12, 2005
  7. Nick HengeveldNov 13, 2005

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.