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 2025/04/06 01:32:06 UTC

(cxf) 08/10: CXF-9121: LEAK: ByteBuf.release() was not called before it's garbage-collected (#2339)

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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 52d4a0a55fd76393bd3a887d8b9b90ae3640764d
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sat Apr 5 10:31:23 2025 -0400

    CXF-9121: LEAK: ByteBuf.release() was not called before it's garbage-collected (#2339)
    
    (cherry picked from commit b200e8ac644bfc41f3a2ec095e41e5afd774fc11)
    (cherry picked from commit bc556641529cdd12193181af334466a81913c44d)
---
 .../http/netty/client/NettyHttpConduit.java          |  2 +-
 .../http2/netty/jaxws/JAXWSAsyncClientTest.java      | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
index de55fdbd30..9cbfc95d73 100644
--- a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
+++ b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
@@ -611,7 +611,7 @@ public class NettyHttpConduit extends HttpClientHTTPConduit implements BusLifeCy
 
         @Override
         protected InputStream getInputStream() throws IOException {
-            return new ByteBufInputStream(getHttpResponseContent().content());
+            return new ByteBufInputStream(getHttpResponseContent().content(), true);
         }
 
         @Override
diff --git a/systests/transport-netty/src/test/java/org/apache/cxf/systest/http2/netty/jaxws/JAXWSAsyncClientTest.java b/systests/transport-netty/src/test/java/org/apache/cxf/systest/http2/netty/jaxws/JAXWSAsyncClientTest.java
index 1ddc1deee0..90e4b37f2c 100644
--- a/systests/transport-netty/src/test/java/org/apache/cxf/systest/http2/netty/jaxws/JAXWSAsyncClientTest.java
+++ b/systests/transport-netty/src/test/java/org/apache/cxf/systest/http2/netty/jaxws/JAXWSAsyncClientTest.java
@@ -33,6 +33,7 @@ import javax.xml.ws.Response;
 import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.greeter_control.AbstractGreeterImpl;
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.types.GreetMeResponse;
@@ -180,4 +181,23 @@ public class JAXWSAsyncClientTest  extends AbstractBusClientServerTestBase {
                        || ex.getCause() instanceof ReadTimeoutException);
         }
     }
+
+    @Test
+    public void testAsyncClientWithLogging() throws Exception {
+        // setup the feature by using JAXWS front-end API
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setAddress("http://localhost:" + PORT + "/SoapContext/GreeterPort");
+        factory.setServiceClass(Greeter.class);
+        factory.setFeatures(List.of(new LoggingFeature()));
+        Greeter proxy = factory.create(Greeter.class);
+
+        Response<GreetMeResponse>  response = proxy.greetMeAsync("cxf");
+        int waitCount = 0;
+        while (!response.isDone() && waitCount < 15) {
+            Thread.sleep(1000);
+            waitCount++;
+        }
+        
+        assertTrue("Response still not received.", response.isDone());
+    }
 }