All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jgit: upload-pack: Force an fd flush after receiving flush pkt from client
@ 2009-03-16 17:34 Dima Zavin
  2009-03-16 20:05 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Dima Zavin @ 2009-03-16 17:34 UTC (permalink / raw)
  To: git; +Cc: spearce, Dima Zavin

Signed-off-by: Dima Zavin <dima@android.com>
---
 .../src/org/spearce/jgit/transport/UploadPack.java |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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)) {
@@ -372,7 +372,6 @@ private void negotiate() throws IOException {
 			} else if (line.equals("done")) {
 				if (commonBase.isEmpty())
 					pckOut.writeString("NAK\n");
-
 				else if (multiAck)
 					pckOut.writeString("ACK " + last.name() + "\n");
 				break;
-- 
1.6.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] jgit: upload-pack: Force an fd flush after receiving flush pkt from client
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-03-16 20:05 UTC (permalink / raw)
  To: Dima Zavin; +Cc: git

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-16 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.