From 98d5e956d080eb15f0ec660ed58458ccf35fb2a5 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Fri, 3 Apr 2015 22:49:47 +0000 Subject: QPID-6429: [Java Broker] Discard only ByteBuffers that have been sent down the wire. In #dowrite, the algorithm means to poll off only the ByteBuffers that have been completely sent down the wire, however it is missing a break. The effect of this is, if we have back pressure and send has been called with an empty ByteBuffer, it can poll away ByteBuffers from the front of the queue that are have content. The Python EchoTests demonstrate the bug because they a) use messages that are sufficient large to cause the client to exert back pressure and b) there are no messages in the properties so send is called with an empty ByteBuffer. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1671203 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/transport/NonBlockingConnection.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'qpid/java') diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/NonBlockingConnection.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/NonBlockingConnection.java index 8cec751825..551d1c5bae 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/NonBlockingConnection.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/transport/NonBlockingConnection.java @@ -494,6 +494,10 @@ public class NonBlockingConnection implements NetworkConnection, ByteBufferSende byteBuffersWritten++; _buffers.poll(); } + else + { + break; + } } @@ -524,6 +528,10 @@ public class NonBlockingConnection implements NetworkConnection, ByteBufferSende byteBuffersWritten++; _buffers.poll(); } + else + { + break; + } } } @@ -582,7 +590,7 @@ public class NonBlockingConnection implements NetworkConnection, ByteBufferSende { LOGGER.warn("Send ignored as the connection is already closed"); } - else + else if (msg.remaining() > 0) { _buffers.add(msg); } -- cgit v1.2.1