{"thread":{"id":"26912","subject":"[PATCH] enable \"no-done\" extension only when fetching over smart-http","startedAt":"2011-03-29T17:16:29Z","lastAt":"2011-03-29T17:32:18Z","messageCount":5,"participants":["Junio C Hamano","Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"164586","messageId":"7vlizxsv82.fsf@alter.siamese.dyndns.org","threadId":"26912","inReplyTo":null,"subject":"[PATCH] enable \"no-done\" extension only when fetching over smart-http","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-29T17:16:29Z","receivedAt":"2011-03-29T17:16:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When 'no-done' protocol extension is used, the upload-pack (i.e. the\nserver side) process stops listening to the fetch-pack after issuing the\nfinal NAK, and starts sending the generated pack data back, but there may\nbe more \"have\" send by the latter in flight that the fetch-pack is\nexpecting to be responded with ACK/NAK.  This will typically result in a\ndeadlock (both will block on write that the other end never reads) or\nSIGPIPE on the fetch-pack end (upload-pack will finish writing a small\npack and goes away).\n\nDisable it unless fetch-pack is running under smart-http, where there is\nno such streaming issue.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin/fetch-pack.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex 59fbda5..52707a8 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -708,7 +708,8 @@ static struct ref *do_fetch_pack(int fd[2],\n \t\tif (server_supports(\"no-done\")) {\n \t\t\tif (args.verbose)\n \t\t\t\tfprintf(stderr, \"Server supports no-done\\n\");\n-\t\t\tno_done = 1;\n+\t\t\tif (args.stateless_rpc)\n+\t\t\t\tno_done = 1;\n \t\t}\n \t}\n \telse if (server_supports(\"multi_ack\")) {\n"},{"id":"164588","messageId":"AANLkTimg5_9dQDq8Xa9pJsx9f6UrNewih+WirKcOP42i@mail.gmail.com","threadId":"26912","inReplyTo":"7vlizxsv82.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] enable \"no-done\" extension only when fetching over smart-http","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2011-03-29T17:24:12Z","receivedAt":"2011-03-29T17:24:12Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"On Tue, Mar 29, 2011 at 10:16, Junio C Hamano <gitster@pobox.com> wrote:\n> When 'no-done' protocol extension is used, the upload-pack (i.e. the\n> server side) process stops listening to the fetch-pack after issuing the\n> final NAK, and starts sending the generated pack data back, but there may\n> be more \"have\" send by the latter in flight that the fetch-pack is\n> expecting to be responded with ACK/NAK.  This will typically result in a\n> deadlock (both will block on write that the other end never reads) or\n> SIGPIPE on the fetch-pack end (upload-pack will finish writing a small\n> pack and goes away).\n>\n> Disable it unless fetch-pack is running under smart-http, where there is\n> no such streaming issue.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n-- \nShawn.\n"},{"id":"164589","messageId":"7vhbalsutw.fsf@alter.siamese.dyndns.org","threadId":"26912","inReplyTo":"7vlizxsv82.fsf@alter.siamese.dyndns.org","subject":"[PATCH] enable \"no-done\" extension only when serving over smart-http","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-29T17:24:59Z","receivedAt":"2011-03-29T17:24:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Do not advertise no-done capability when upload-pack is not serving over\nsmart-http, as there is no way for this server to know when it should stop\nreading in-flight data from the client, even though it is necessary to\ndrain all the in-flight data in order to unblock the client.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n upload-pack.c |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5924f6f..a247fb9 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -640,15 +640,16 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo\n {\n \tstatic const char *capabilities = \"multi_ack thin-pack side-band\"\n \t\t\" side-band-64k ofs-delta shallow no-progress\"\n-\t\t\" include-tag multi_ack_detailed no-done\";\n+\t\t\" include-tag multi_ack_detailed\";\n \tstruct object *o = parse_object(sha1);\n \n \tif (!o)\n \t\tdie(\"git upload-pack: cannot find object %s:\", sha1_to_hex(sha1));\n \n \tif (capabilities)\n-\t\tpacket_write(1, \"%s %s%c%s\\n\", sha1_to_hex(sha1), refname,\n-\t\t\t0, capabilities);\n+\t\tpacket_write(1, \"%s %s%c%s%s\\n\", sha1_to_hex(sha1), refname,\n+\t\t\t     0, capabilities,\n+\t\t\t     stateless_rpc ? \" no-done\" : \"\");\n \telse\n \t\tpacket_write(1, \"%s %s\\n\", sha1_to_hex(sha1), refname);\n \tcapabilities = NULL;\n"},{"id":"164591","messageId":"AANLkTinuWGN9FcQoONboFK9WdrRYU+NypmWjNAfGc=_B@mail.gmail.com","threadId":"26912","inReplyTo":"7vhbalsutw.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] enable \"no-done\" extension only when serving over smart-http","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2011-03-29T17:31:11Z","receivedAt":"2011-03-29T17:31:11Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"On Tue, Mar 29, 2011 at 10:24, Junio C Hamano <gitster@pobox.com> wrote:\n> Do not advertise no-done capability when upload-pack is not serving over\n> smart-http, as there is no way for this server to know when it should stop\n> reading in-flight data from the client, even though it is necessary to\n> drain all the in-flight data in order to unblock the client.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n-- \nShawn.\n"},{"id":"164593","messageId":"7vfwq5suhp.fsf@alter.siamese.dyndns.org","threadId":"26912","inReplyTo":"7vlizxsv82.fsf@alter.siamese.dyndns.org","subject":"[PATCH] enable \"no-done\" extension only when serving over smart-http","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-03-29T17:32:18Z","receivedAt":"2011-03-29T17:32:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Do not advertise no-done capability when upload-pack is not serving over\nsmart-http, as there is no way for this server to know when it should stop\nreading in-flight data from the client, even though it is necessary to\ndrain all the in-flight data in order to unblock the client.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * Sorry for the resend...\n\n upload-pack.c |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5924f6f..a247fb9 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -640,15 +640,16 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo\n {\n \tstatic const char *capabilities = \"multi_ack thin-pack side-band\"\n \t\t\" side-band-64k ofs-delta shallow no-progress\"\n-\t\t\" include-tag multi_ack_detailed no-done\";\n+\t\t\" include-tag multi_ack_detailed\";\n \tstruct object *o = parse_object(sha1);\n \n \tif (!o)\n \t\tdie(\"git upload-pack: cannot find object %s:\", sha1_to_hex(sha1));\n \n \tif (capabilities)\n-\t\tpacket_write(1, \"%s %s%c%s\\n\", sha1_to_hex(sha1), refname,\n-\t\t\t0, capabilities);\n+\t\tpacket_write(1, \"%s %s%c%s%s\\n\", sha1_to_hex(sha1), refname,\n+\t\t\t     0, capabilities,\n+\t\t\t     stateless_rpc ? \" no-done\" : \"\");\n \telse\n \t\tpacket_write(1, \"%s %s\\n\", sha1_to_hex(sha1), refname);\n \tcapabilities = NULL;\n"}]}