You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/11/14 22:18:08 UTC

[cxf] branch master updated: CXF-8617: The org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduitTest hangs intermittently (#875)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 6486b53  CXF-8617: The org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduitTest hangs intermittently (#875)
6486b53 is described below

commit 6486b53b8838fbb0a84688461585c1a5768f05ce
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Nov 14 17:18:01 2021 -0500

    CXF-8617: The org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduitTest hangs intermittently (#875)
---
 .../cxf/transport/http/asyncclient/hc5/SharedOutputBuffer.java      | 3 +--
 .../cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitTest.java    | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedOutputBuffer.java b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedOutputBuffer.java
index 42ddc13..b0b9ed2 100644
--- a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedOutputBuffer.java
+++ b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/SharedOutputBuffer.java
@@ -119,10 +119,9 @@ public class SharedOutputBuffer extends ExpandableBuffer {
                     bytesWritten = channel.write(buffer());
                 }
             }
-            if ((largeWrapper == null || !largeWrapper.hasRemaining()) && !super.hasData()) {
+            if ((largeWrapper == null || !largeWrapper.hasRemaining()) && !super.hasData() && this.endOfStream) {
                 // No more buffered content
                 // If at the end of the stream, terminate
-                this.endOfStream = true;
                 channel.endStream();
             }
             // no need to signal if the large wrapper is present and has data remaining
diff --git a/rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitTest.java b/rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitTest.java
index b072c56..42ecaf4 100644
--- a/rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitTest.java
+++ b/rt/transports/http-hc5/src/test/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitTest.java
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.xml.ws.AsyncHandler;
@@ -320,7 +321,10 @@ public class AsyncHTTPConduitTest extends AbstractBusClientServerTestBase {
                     } else {
                         Thread.sleep(50);
                     }
-                    initialThreadsLatch.await();
+                    if (!initialThreadsLatch.await(30, TimeUnit.SECONDS)) {
+                        throw new TimeoutException("The initial threads latch timeout exceeded,"
+                            + " exception in JaxwsClientCallback?");
+                    }
                     doneLatch.countDown();
                 } catch (Exception e) {
                     throw new RuntimeException(e);