git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Hengeveld <nickh@reactrix.com>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Cc: git@vger.kernel.org
Subject: Re: maybe breakage with latest git-pull and http protocol
Date: Thu, 20 Oct 2005 10:43:24 -0700	[thread overview]
Message-ID: <20051020174324.GD6160@reactrix.com> (raw)
In-Reply-To: <867jciz18w.fsf@blue.stonehenge.com>

Can you try using the following patch?  This cleans up curl handles for
active request slots that are no longer in use.  If all other prefetched
requests finish while a large transfer is happening, the active slots
currently keep open connections to the server and I'm guessing that
perhaps by the time additional objects are prefetched the server has
timed out some of those keepalive connections.


---

 http-fetch.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

applies-to: ce9a5a0fdd52a29e370d849a132b4509c844aca1
04b4353279eaceb7e7c3d73a9565b219aa7a10a9
diff --git a/http-fetch.c b/http-fetch.c
index a7dc2cc..d26fae8 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -291,11 +291,7 @@ static struct active_request_slot *get_a
 	}
 	if (slot == NULL) {
 		newslot = xmalloc(sizeof(*newslot));
-#ifdef NO_CURL_EASY_DUPHANDLE
-		newslot->curl = get_curl_handle();
-#else
-		newslot->curl = curl_easy_duphandle(curl_default);
-#endif
+		newslot->curl = NULL;
 		newslot->in_use = 0;
 		newslot->next = NULL;
 
@@ -311,6 +307,14 @@ static struct active_request_slot *get_a
 		slot = newslot;
 	}
 
+	if (slot->curl == NULL) {
+#ifdef NO_CURL_EASY_DUPHANDLE
+		slot->curl = get_curl_handle();
+#else
+		slot->curl = curl_easy_duphandle(curl_default);
+#endif
+	}
+
 	active_requests++;
 	slot->in_use = 1;
 	slot->done = 0;
@@ -612,6 +616,7 @@ void process_curl_messages(void)
 void process_request_queue(void)
 {
 	struct transfer_request *request = request_queue_head;
+	struct active_request_slot *slot = active_queue_head;
 	int num_transfers;
 
 	while (active_requests < max_requests && request != NULL) {
@@ -624,6 +629,14 @@ void process_request_queue(void)
 		}
 		request = request->next;
 	}
+
+	while (slot != NULL) {
+		if (!slot->in_use && slot->curl != NULL) {
+			curl_easy_cleanup(slot->curl);
+			slot->curl = NULL;
+		}
+		slot = slot->next;
+	}				
 }
 #endif
 
@@ -1297,7 +1310,8 @@ int main(int argc, char **argv)
 #endif
 	slot = active_queue_head;
 	while (slot != NULL) {
-		curl_easy_cleanup(slot->curl);
+		if (slot->curl != NULL)
+			curl_easy_cleanup(slot->curl);
 		slot = slot->next;
 	}
 #ifdef USE_CURL_MULTI
---
0.99.8.GIT

-- 
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.

      parent reply	other threads:[~2005-10-20 17:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-13  0:53 maybe breakage with latest git-pull and http protocol Randal L. Schwartz
2005-10-13  5:50 ` Junio C Hamano
2005-10-14 10:58 ` Randal L. Schwartz
2005-10-14 15:42   ` Junio C Hamano
2005-10-14 16:18     ` Randal L. Schwartz
2005-10-14 19:56       ` Daniel Barkalow
2005-10-15 13:03         ` Randal L. Schwartz
2005-10-15 16:04           ` Junio C Hamano
2005-10-15 16:22             ` Junio C Hamano
2005-10-15 19:41               ` Daniel Barkalow
2005-10-15 21:56                 ` Nick Hengeveld
2005-10-15 21:21               ` Nick Hengeveld
2005-10-15 16:37           ` Junio C Hamano
2005-10-15 17:13           ` Junio C Hamano
2005-10-15 21:57           ` Nick Hengeveld
2005-10-15 22:04             ` Randal L. Schwartz
2005-10-20 17:43 ` Nick Hengeveld [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051020174324.GD6160@reactrix.com \
    --to=nickh@reactrix.com \
    --cc=git@vger.kernel.org \
    --cc=merlyn@stonehenge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).