Skip to contentSkip to conversation

http-fetch fixes

PATCH In review Mark Wooding 4 participants 19 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover http-fetch fixes

This patch series fixes the git-http-fetch bug I reported in `git-http-fetch failure/segfault -- alas no patch'. The preliminary patch I was working on /did/ actually fix the bug I found, but uncovered a bunch more, which I think I've finally got to the bottom of.

The series applies to commit 1506fc34f7585880aeeb12b5fdfe2de4800f9df5.

Particularly:

1. watch-slot -- my fix for the actual bug. Different from Nick Hangeval's separate-status structure, it works by locking slots that people still want answers from. I've turned the in_use slot field into a bit mask and added a reference counter. I think you can use Nick's patch instead if you prefer it.

2, 3. list-corruption, abort-object-request -- fix bugs uncovered by
watch-slot. See the patch emails for the details.

4, 5, 6, 7. multi-fdset, fix-rename-message, curl-verbose,
par-control-flow-tidy -- various other relatively trivial changes I noticed while doing the main work above. fix-rename-message is actually a bug, but if you think some other fix is better, that's cool; the others are cosmetic things.

8, 9. sanity-check-active-slots, sanity-check-object-queue --
debugging code I threw in while I was trying to track down the main bugs. I'm not going to cry if these aren't accepted (indeed, I separated them out and put them at the end specifically!) but they might prove useful to someone, so I thought I'd send 'em along anyway.

-- [mdw]

#1 lore raw

PATCH 1/9 http-fetch: Mark slots as `watched' to stop them being reused.

From: Mark Wooding <[email protected]>

Previously, it was possible for the slot passed to run_active_slot() to be reused before that function returned, rendering its completion status useless. This is particularly noticeable when fetching a repository with a wide, flat directory structure (lots of blobs in the top-level tree), a single unpacked commit which changes just one or two blobs, and the rest of the history in one pack. When fetch_indices() gets the pack-list, the slot is (usually!) reused for some blob object which is packed, so it fails with 404; fetch_indices() decides that the pack-list fetch failed, and nothing therefore fetches the pack.

We fix this by adding a feature to lock slots against reuse.

---

 http-fetch.c |    6 +++---
 http.c       |   43 +++++++++++++++++++++++++++++++++----------
 http.h       |    6 +++++-
 3 files changed, 41 insertions(+), 14 deletions(-)
http-fetch.c +3 -3
index 61b2188..4b1b62d 100644
@@ -465,13 +465,13 @@ static void process_alternates_response(
 				base);
 			curl_easy_setopt(slot->curl, CURLOPT_URL,
 					 alt_req->url);
-			active_requests++;
-			slot->in_use = 1;
+			if (!slot->in_use)
+				active_requests++;
+			slot->in_use |= SLOTUSE_ACTIVE;
 			if (start_active_slot(slot)) {
 				return;
 			} else {
 				got_alternates = -1;
-				slot->in_use = 0;
 				return;
 			}
 		}
http.c +33 -10

104 lines not on this page · raw message

http.h +5 -1
index ed4ea33..a66e06a 100644
@@ -26,7 +26,8 @@ struct active_request_slot
 {
 	CURL *curl;
 	FILE *local;
-	int in_use;
+	unsigned in_use;
+	int nrefs;
 	CURLcode curl_result;
 	long http_code;
 	void *callback_data;
@@ -34,6 +35,9 @@ struct active_request_slot
 	struct active_request_slot *next;
 };
 
+#define SLOTUSE_ACTIVE 1u
+#define SLOTUSE_REF 2u
+
 struct buffer
 {
         size_t posn;
#2 lore raw

PATCH 2/9 http-fetch: Fix object list corruption in fill_active_slots().

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

In fill_active_slots() -- if we find an object which has already arrived, say as part of a pack, /don't/ remove it from the list. It's already been prefetched and someone will ask for it later. Just label it as done and carry blithely on. (As it was, the code would dereference a freed object to continue through the list anyway.)

---

 http-fetch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
http-fetch.c +1 -1
index 4b1b62d..b1ee836 100644
@@ -312,7 +312,7 @@ void fill_active_slots(void)
 	while (active_requests < max_requests && obj_req != NULL) {
 		if (obj_req->state == WAITING) {
 			if (has_sha1_file(obj_req->sha1))
-				release_object_request(obj_req);
+				obj_req->state = COMPLETE;
 			else
 				start_object_request(obj_req);
 			curl_multi_perform(curlm, &num_transfers);
#3 lore raw

PATCH 3/9 http-fetch: Abort requests for objects which arrived in packs

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

In fetch_object, there's a call to release an object request if the object mysteriously arrived, say in a pack. Unfortunately, the fetch attempt for this object might already be in progress, and we'll leak the descriptor. Instead, try to tidy away the request.

---

 http-fetch.c |   16 +++++++++++++++-
 http.c       |   20 ++++++++++++++++++--
 http.h       |    1 +
 3 files changed, 34 insertions(+), 3 deletions(-)
http-fetch.c +15 -1
index b1ee836..8656070 100644
@@ -770,6 +770,20 @@ static int fetch_pack(struct alt_base *r
 	return 0;
 }
 
+static void abort_object_request(struct object_request *obj_req)
+{
+	if (obj_req->local >= 0) {
+		close(obj_req->local);
+		obj_req->local = -1;
+	}
+	unlink(obj_req->tmpfile);
+	if (obj_req->slot) {
+ 		release_active_slot(obj_req->slot);
+		obj_req->slot = NULL;
+	}
+	release_object_request(obj_req);
+}
+
 static int fetch_object(struct alt_base *repo, unsigned char *sha1)
 {
 	char *hex = sha1_to_hex(sha1);
@@ -782,7 +796,7 @@ static int fetch_object(struct alt_base 
 		return error("Couldn't find request for %s in the queue", hex);
 
 	if (has_sha1_file(obj_req->sha1)) {
-		release_object_request(obj_req);
+		abort_object_request(obj_req);
 		return 0;
 	}
 
http.c +18 -2
index 498b4ae..0a70e1c 100644
@@ -438,11 +438,27 @@ void run_active_slot(struct active_reque
 #endif
 }
 
-static void finish_active_slot(struct active_request_slot *slot)
+static void closedown_active_slot(struct active_request_slot *slot)
 {
-	slot->in_use &= ~SLOTUSE_ACTIVE;
+        slot->in_use &= ~SLOTUSE_ACTIVE;
 	if (!slot->in_use)
 		active_requests--;
+}
+
+void release_active_slot(struct active_request_slot *slot)
+{
+	closedown_active_slot(slot);
+	if (slot->curl) {
+		curl_multi_remove_handle(curlm, slot->curl);
+		curl_easy_cleanup(slot->curl);
+		slot->curl = NULL;
+	}
+	fill_active_slots();
+}
+
+static void finish_active_slot(struct active_request_slot *slot)
+{
+	closedown_active_slot(slot);
         curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CODE, &slot->http_code);
  
         /* Run callback if appropriate */
http.h +1 -0
index a66e06a..d028a5d 100644
@@ -58,6 +58,7 @@ extern struct active_request_slot *get_a
 extern int start_active_slot(struct active_request_slot *slot);
 extern void run_active_slot(struct active_request_slot *slot);
 extern void finish_all_active_slots(void);
+extern void release_active_slot(struct active_request_slot *slot);
 
 #ifdef USE_CURL_MULTI
 extern void fill_active_slots(void);
#4 lore raw

Re: [PATCH 3/9] http-fetch: Abort requests for objects which arrived in packs

http.c void run_active_slot(struct active_reque · line 457

Quoted 10 lines · Mark Wooding
http.c +10 -0
+void release_active_slot(struct active_request_slot *slot)
+{
+	closedown_active_slot(slot);
+	if (slot->curl) {
+		curl_multi_remove_handle(curlm, slot->curl);
+		curl_easy_cleanup(slot->curl);
+		slot->curl = NULL;
+	}
+	fill_active_slots();
+}

Does it make sense to call curl_easy_cleanup here? This will close persistent server connections and cause another connection startup if the slot is reused.

Signature · 2 lines
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
#5 lore raw

Re: [PATCH 3/9] http-fetch: Abort requests for objects which arrived in packs

Quoted 3 lines · Nick Hengeveld

Does it make sense to call curl_easy_cleanup here? This will close persistent server connections and cause another connection startup if the slot is reused.

I'm by no means a Curl expert. But I scoured the docs for another way of interrupting the current fetch and I couldn't find anything. It really didn't seem like a good idea to leave the handle as it was, having (possibly) half-fetched a thing we weren't actually interested in -- that way lies confusion.

Besides, in practice, what's happened is that the object we asked for is in a pack which we've just collected. Unless the upstream repository hasn't been git-prune-packed, our fetch is going to fail with a 404 anyway, at which point Curl /will/ close the connection and make another one next time. So, in real life, it makes no difference.

-- [mdw]

#6 lore raw

Re: [PATCH 3/9] http-fetch: Abort requests for objects which arrived in packs

Quoted 5 lines · Mark Wooding

I'm by no means a Curl expert. But I scoured the docs for another way of interrupting the current fetch and I couldn't find anything. It really didn't seem like a good idea to leave the handle as it was, having (possibly) half-fetched a thing we weren't actually interested in -- that way lies confusion.

My impression from the curl documentation was that removing the curl handle from the multi session was enough, but the documentation doesn't describe what happens to such a request.

Quoted 5 lines

Besides, in practice, what's happened is that the object we asked for is in a pack which we've just collected. Unless the upstream repository hasn't been git-prune-packed, our fetch is going to fail with a 404 anyway, at which point Curl /will/ close the connection and make another one next time. So, in real life, it makes no difference.

Good point, and it does seem safer to fully clean up the connection rather than leave it in a questionable state.

Signature · 2 lines
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
#7 lore raw

PATCH 4/9 http-fetch: Actually watch the file descriptors of interest.

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

Presumably this was just some kind of oversight.

---

 http.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
http.c +2 -0
index 0a70e1c..521323c 100644
@@ -425,6 +425,8 @@ void run_active_slot(struct active_reque
 			FD_ZERO(&excfds);
 			select_timeout.tv_sec = 0;
 			select_timeout.tv_usec = 50000;
+			curl_multi_fdset(curlm, &readfds, &writefds,
+					 &excfds, &max_fd);
 			select(max_fd, &readfds, &writefds,
 			       &excfds, &select_timeout);
 		}
#8 lore raw

Re: [PATCH 4/9] http-fetch: Actually watch the file descriptors of interest.

Quoted 1 line · Mark Wooding

Presumably this was just some kind of oversight.

I was never able to make this work reliably across multiple versions of curl.

Quoted 24 lines

---

 http.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
http.c +2 -1
index 0a70e1c..521323c 100644
@@ -425,6 +425,8 @@ void run_active_slot(struct active_reque
 			FD_ZERO(&excfds);
 			select_timeout.tv_sec = 0;
 			select_timeout.tv_usec = 50000;
+			curl_multi_fdset(curlm, &readfds, &writefds,
+					 &excfds, &max_fd);
 			select(max_fd, &readfds, &writefds,
 			       &excfds, &select_timeout);
 		}
 
-

To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
#9 lore raw

PATCH 5/9 http-fetch: Fix message reporting rename of object file.

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

move_temp_to_file returns 0 or -1. This is not a good thing to pass to strerror(3). Fortunately, someone already reported the error, so don't worry too much.

---

 http-fetch.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
http-fetch.c +2 -3
index 8656070..f1aac14 100644
@@ -831,9 +831,8 @@ static int fetch_object(struct alt_base 
 	} else if (memcmp(obj_req->sha1, obj_req->real_sha1, 20)) {
 		ret = error("File %s has bad hash\n", hex);
 	} else if (obj_req->rename < 0) {
-		ret = error("unable to write sha1 filename %s: %s",
-			    obj_req->filename,
-			    strerror(obj_req->rename));
+		ret = error("unable to write sha1 filename %s",
+			    obj_req->filename);
 	}
 
 	release_object_request(obj_req);
#10 lore raw

PATCH 6/9 http: Turn on verbose Curl messages if GIT_CURL_VERBOSE set in environment

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

---

 http.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
http.c +3 -0
index 521323c..d0c92dc 100644
@@ -192,6 +192,9 @@ static CURL* get_curl_handle(void)
 
 	curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
 
+	if (getenv("GIT_CURL_VERBOSE"))
+		curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
+
 	return result;
 }
 
#11 lore raw

PATCH 7/9 http-fetch: Tidy control flow in process_alternate_response

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

It's a bit convoluted. Tidy it up.

---

 http-fetch.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
http-fetch.c +2 -5
index f1aac14..4aa5a11 100644
@@ -468,12 +468,9 @@ static void process_alternates_response(
 			if (!slot->in_use)
 				active_requests++;
 			slot->in_use |= SLOTUSE_ACTIVE;
-			if (start_active_slot(slot)) {
-				return;
-			} else {
+			if (!start_active_slot(slot))
 				got_alternates = -1;
-				return;
-			}
+			return;
 		}
 	} else if (slot->curl_result != CURLE_OK) {
 		if (slot->http_code != 404 &&
#12 lore raw

PATCH 8/9 http: Paranoid sanity checking for active slots.

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

Probably not wanted in the mainline, but very useful when debugging.

---

 http-fetch.c |    2 ++
 http.c       |   28 ++++++++++++++++++++++++++++
 http.h       |    1 +
 3 files changed, 31 insertions(+), 0 deletions(-)
http-fetch.c +2 -0
index 4aa5a11..fa3eb4a 100644
@@ -465,9 +465,11 @@ static void process_alternates_response(
 				base);
 			curl_easy_setopt(slot->curl, CURLOPT_URL,
 					 alt_req->url);
+			sanity_check_active_slots();
 			if (!slot->in_use)
 				active_requests++;
 			slot->in_use |= SLOTUSE_ACTIVE;
+			sanity_check_active_slots();
 			if (!start_active_slot(slot))
 				got_alternates = -1;
 			return;
http.c +28 -0
index d0c92dc..8087ca0 100644
@@ -1,3 +1,4 @@
+#include <assert.h>
 #include "http.h"
 
 int data_received;
@@ -348,19 +349,36 @@ struct active_request_slot *get_active_s
 	return slot;
 }
 
+void sanity_check_active_slots(void)
+{
+	struct active_request_slot *slot;
+	int n = 0;
+
+	for (slot = active_queue_head; slot; slot = slot->next) {
+		assert(!(slot->in_use & SLOTUSE_REF) == !slot->nrefs);
+		if (slot->in_use)
+			n++;
+	}
+	assert(n == active_requests);
+}
+
 int start_active_slot(struct active_request_slot *slot)
 {
+	sanity_check_active_slots();
 #ifdef USE_CURL_MULTI
 	CURLMcode curlm_result = curl_multi_add_handle(curlm, slot->curl);
 
 	if (curlm_result != CURLM_OK &&
 	    curlm_result != CURLM_CALL_MULTI_PERFORM) {
+		assert(slot->in_use & SLOTUSE_ACTIVE);
 		slot->in_use &= ~SLOTUSE_ACTIVE;
 		if (!slot->in_use)
 			active_requests--;
+		assert(active_requests >= 0);
 		return 0;
 	}
 #endif
+	sanity_check_active_slots();
 	return 1;
 }
 
@@ -382,20 +400,26 @@ void step_active_slots(void)
 
 static void watch_active_slot(struct active_request_slot *slot)
 {
+	sanity_check_active_slots();
 	if (!slot->in_use)
 		active_requests++;
 	slot->in_use |= SLOTUSE_REF;
 	slot->nrefs++;
+	sanity_check_active_slots();
 }
 
 static void unwatch_active_slot(struct active_request_slot *slot)
 {
+	sanity_check_active_slots();
+	assert(slot->nrefs);
 	slot->nrefs--;
 	if (!slot->nrefs) {
 		slot->in_use &= ~SLOTUSE_REF;
 		if (!slot->in_use)
 			active_requests--;
+		assert(active_requests >= 0);
 	}
+	sanity_check_active_slots();
 }
 
 void run_active_slot(struct active_request_slot *slot)
@@ -445,9 +469,13 @@ void run_active_slot(struct active_reque
 
 static void closedown_active_slot(struct active_request_slot *slot)
 {
+	sanity_check_active_slots();
+	assert(slot->in_use & SLOTUSE_ACTIVE);
         slot->in_use &= ~SLOTUSE_ACTIVE;
 	if (!slot->in_use)
 		active_requests--;
+	assert(active_requests >= 0);
+	sanity_check_active_slots();
 }
 
 void release_active_slot(struct active_request_slot *slot)
http.h +1 -0
index d028a5d..a2e48e8 100644
@@ -59,6 +59,7 @@ extern int start_active_slot(struct acti
 extern void run_active_slot(struct active_request_slot *slot);
 extern void finish_all_active_slots(void);
 extern void release_active_slot(struct active_request_slot *slot);
+extern void sanity_check_active_slots(void);
 
 #ifdef USE_CURL_MULTI
 extern void fill_active_slots(void);
#13 lore raw

PATCH 9/9 http-fetch: Paranoid sanity checking for the object queue.

In reply to Mark Wooding

From: Mark Wooding <[email protected]>

Probably not wanted in the mainline, but useful for debugging.

---

 http-fetch.c |   70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)
http-fetch.c +70 -0
index fa3eb4a..80eaa2f 100644
@@ -3,6 +3,7 @@
 #include "pack.h"
 #include "fetch.h"
 #include "http.h"
+#include <assert.h>
 
 #define PREV_BUF_SIZE 4096
 #define RANGE_HEADER_SIZE 30
@@ -28,6 +29,13 @@ enum object_request_state {
 	COMPLETE,
 };
 
+typedef struct stash {
+	struct stash *next;
+	unsigned char sha1[20];
+	int activep;
+	int tickp;
+} stash;
+
 struct object_request
 {
 	unsigned char sha1[20];
@@ -47,6 +55,7 @@ struct object_request
 	int rename;
 	struct active_request_slot *slot;
 	struct object_request *next;
+	stash *tick;
 };
 
 struct alternates_request {
@@ -57,8 +66,60 @@ struct alternates_request {
 	int http_specific;
 };
 
+static stash *seen = 0;
+
+static stash *findstash(unsigned char *sha1)
+{
+	stash *s;
+	for (s = seen; s; s = s->next) {
+		if (memcmp(sha1, s->sha1, 20) == 0)
+			return s;
+	}
+	return NULL;
+}
+
+static stash *enstash(unsigned char *sha1)
+{
+	stash *s;
+	if ((s = findstash(sha1)) != NULL)
+		assert(!s->activep);
+	else {
+		s = xmalloc(sizeof(*s));
+		memcpy(s->sha1, sha1, 20);
+		s->next = seen;
+		seen = s;
+	}
+	s->activep = 1;
+	return s;
+}
+
+static void unstash(unsigned char *sha1)
+{
+	stash *s = findstash(sha1);
+	assert(s && s->activep);
+	s->activep = 0;
+}
+
 static struct object_request *object_queue_head = NULL;
 
+static void sanity_check_stash(void)
+{
+	stash *s;
+	struct object_request *obj_req;
+
+	for (s = seen; s; s = s->next)
+		s->tickp = 0;
+	for (obj_req = object_queue_head; obj_req; obj_req = obj_req->next) {
+		assert(obj_req->tick);
+		s = obj_req->tick;
+		assert(memcmp(s->sha1, obj_req->sha1, 20) == 0);
+		assert(s->activep);
+		s->tickp = 1;
+	}
+	for (s = seen; s; s = s->next)
+		assert(!s->tickp == !s->activep);
+}
+
 static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
 			       void *data)
 {
@@ -287,6 +348,7 @@ static void release_object_request(struc
 {
 	struct object_request *entry = object_queue_head;
 
+	sanity_check_stash();
 	if (obj_req->local != -1)
 		error("fd leakage in release: %d", obj_req->local);
 	if (obj_req == object_queue_head) {
@@ -298,6 +360,8 @@ static void release_object_request(struc
 			entry->next = entry->next->next;
 	}
 
+	unstash(obj_req->sha1);
+	sanity_check_stash();
 	free(obj_req->url);
 	free(obj_req);
 }
@@ -309,6 +373,7 @@ void fill_active_slots(void)
 	struct active_request_slot *slot = active_queue_head;
 	int num_transfers;
 
+	sanity_check_stash();
 	while (active_requests < max_requests && obj_req != NULL) {
 		if (obj_req->state == WAITING) {
 			if (has_sha1_file(obj_req->sha1))
@@ -327,6 +392,7 @@ void fill_active_slots(void)
 		}
 		slot = slot->next;
 	}				
+	sanity_check_stash();
 }
 #endif
 
@@ -347,6 +413,7 @@ void prefetch(unsigned char *sha1)
 		 "%s.temp", filename);
 	newreq->next = NULL;
 
+	sanity_check_stash();
 	if (object_queue_head == NULL) {
 		object_queue_head = newreq;
 	} else {
@@ -356,6 +423,8 @@ void prefetch(unsigned char *sha1)
 		}
 		tail->next = newreq;
 	}
+	newreq->tick = enstash(sha1);
+	sanity_check_stash();
 
 #ifdef USE_CURL_MULTI
 	fill_active_slots();
@@ -789,6 +858,7 @@ static int fetch_object(struct alt_base 
 	int ret = 0;
 	struct object_request *obj_req = object_queue_head;
 
+	sanity_check_stash();
 	while (obj_req != NULL && memcmp(obj_req->sha1, sha1, 20))
 		obj_req = obj_req->next;
 	if (obj_req == NULL)
#14 lore raw
In reply to Mark Wooding

Hello Mark,

Quoted 6 lines · Mark Wooding

This patch series fixes the git-http-fetch bug I reported in `git-http-fetch failure/segfault -- alas no patch'. The preliminary patch I was working on /did/ actually fix the bug I found, but uncovered a bunch more, which I think I've finally got to the bottom of.

The series applies to commit 1506fc34f7585880aeeb12b5fdfe2de4800f9df5.

after reverting c8568e139ed2149fbfb7ef9a8d819d5b6b7c554f it applies to 8233340ce6eb700eb2cd9c0fef4d1705997c499b (=current master), too.

With these patches applied, I get now a Segfault, while cloning u-boot.

        walk a7b9fb9110e3c0be644b3e2c8f397f606138a710
        got 98dce899a97f7998b11f58e8c7897ba9f7e0b95a
        got 0cfa422c45d2e2b6023b74a3784034bb18a7eb73
        got 9341e20e95c5ff5c36a8f9506b4039bbc6aefd43
        /home/uzeisberger/usr/bin/git-clone: line 42: 24002 Segmentation fault
        git-http-fetch -v -a -w "$name" "$name" "$1/"

Actually now I cannot reproduce it anymore. I added some debugging code s.t. I can give more details if it reoccurs.

Best regards
Uwe

Signature · 3 lines
Uwe Zeisberger

http://www.google.com/search?q=5+choose+3
#15 lore raw
Quoted 3 lines · Uwe Zeisberger
Quoted 1 line

The series applies to commit 1506fc34f7585880aeeb12b5fdfe2de4800f9df5.

after reverting c8568e139ed2149fbfb7ef9a8d819d5b6b7c554f it applies to 8233340ce6eb700eb2cd9c0fef4d1705997c499b (=current master), too.

Good-oh. (I did pull the latest tip, and then panicked because Nick's change had already made it out.)

Quoted 2 lines

With these patches applied, I get now a Segfault, while cloning u-boot.

Oh. :-(

Quoted 2 lines

Actually now I cannot reproduce it anymore. I added some debugging code s.t. I can give more details if it reoccurs.

Please do. I've just tried, and I can't reproduce the problem either.

The watch-slots patch seems to uncover all manner of brokenness in http-fetch.c -- or I've violated some unwritten assumptions of a very deep nature, which is always possible.

Maybe the right thing to do is to go with Nick's separate-status- structures patch as an actual mainline fix, with my patches for http-fetch.c's other bugs as a belt-and-braces.

-- [mdw]

#16 lore raw
Quoted 8 lines · Mark Wooding
Quoted 2 lines · Uwe Zeisberger

With these patches applied, I get now a Segfault, while cloning u-boot.

...
Maybe the right thing to do is to go with Nick's separate-status- structures patch as an actual mainline fix, with my patches for http-fetch.c's other bugs as a belt-and-braces.

Thanks.

I briefly looked at the series; the following may be ready to be applied:

[PATCH 2/9] http-fetch: Fix object list corruption in fill_activ... [PATCH 5/9] http-fetch: Fix message reporting rename of object file [PATCH 6/9] http: Turn on verbose Curl messages if GIT_CURL_VERB... [PATCH 7/9] http-fetch: Tidy control flow in process_alternate_r...

For now however I'll wait and see for a while, in case you can reproduce the breakage Uwe found and add fixes to your set.

#17 lore raw
Quoted 10 lines · Junio C Hamano

I briefly looked at the series; the following may be ready to be applied:

[PATCH 2/9] http-fetch: Fix object list corruption in fill_activ... [PATCH 5/9] http-fetch: Fix message reporting rename of object file [PATCH 6/9] http: Turn on verbose Curl messages if GIT_CURL_VERB... [PATCH 7/9] http-fetch: Tidy control flow in process_alternate_r...

For now however I'll wait and see for a while, in case you can reproduce the breakage Uwe found and add fixes to your set.

I've not had any more trouble with this since, but I'm still worried that the http fetcher is rather fragile. :-(

What was wrong with 3/9, by the way? (It's the abort_active_slot patch -- which does fix a real bug.) Is it just that it doesn't apply cleanly without the first one? If so, I can send out a new patch easily enough.

-- [mdw]

#18 lore raw
Quoted 10 lines · Mark Wooding
Quoted 8 lines · Junio C Hamano

I briefly looked at the series; the following may be ready to be applied:

[PATCH 2/9] http-fetch: Fix object list corruption in fill_activ... [PATCH 5/9] http-fetch: Fix message reporting rename of object file [PATCH 6/9] http: Turn on verbose Curl messages if GIT_CURL_VERB... [PATCH 7/9] http-fetch: Tidy control flow in process_alternate_r...

Quoted 8 lines
Quoted 2 lines

For now however I'll wait and see for a while, in case you can reproduce the breakage Uwe found and add fixes to your set.

I've not had any more trouble with this since, but I'm still worried that the http fetcher is rather fragile. :-(

What was wrong with 3/9, by the way? (It's the abort_active_slot patch -- which does fix a real bug.)

I saw Nick raised an alternative and you responded but I did not see Nick agreeing or disagreeing to it, and I haven't spent enough time on that to convince myself which way to go. That is why.

Maybe this weekend.