From: "Shawn O. Pearce" <spearce@spearce.org>
To: Dima Zavin <dima@android.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] jgit: upload-pack: Force an fd flush after receiving flush pkt from client
Date: Mon, 16 Mar 2009 13:05:15 -0700 [thread overview]
Message-ID: <20090316200515.GQ22920@spearce.org> (raw)
In-Reply-To: <1237224864-15649-1-git-send-email-dima@android.com>
Dima Zavin <dima@android.com> wrote:
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
> index 71acda1..80c154b 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
> @@ -351,7 +351,7 @@ private void negotiate() throws IOException {
> if (line.length() == 0) {
> if (commonBase.isEmpty() || multiAck)
> pckOut.writeString("NAK\n");
> -
> + pckOut.flush();
> } else if (line.startsWith("have ") && line.length() == 45) {
> final ObjectId id = ObjectId.fromString(line.substring(5));
> if (matchHave(id)) {
Applied, but with this more verbose commit message:
--8<--
upload-pack: Force an fd flush after receiving flush pkt from client
The client is blocked waiting for an ACK or NAK line from the server.
If we don't call flush() here there is a very good chance the
ACK/NAK is stuck in our stream buffer within the JRE, and doesn't
make it into the kernel's TCP buffer. This causes the server to
wait for more have lines, and the client to wait for the ACK/NAK,
and the entire thing just deadlocks.
We flush anytime we see a pkt-line flush command, as there may be
buffered ACK lines from prior evaulations that need to be sent to
the waiting client.
Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
--
Shawn.
prev parent reply other threads:[~2009-03-16 20:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-16 17:34 [PATCH] jgit: upload-pack: Force an fd flush after receiving flush pkt from client Dima Zavin
2009-03-16 20:05 ` Shawn O. Pearce [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=20090316200515.GQ22920@spearce.org \
--to=spearce@spearce.org \
--cc=dima@android.com \
--cc=git@vger.kernel.org \
/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).