[jira] [Created] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)
Sebastian Violet created CXF-8950:
-

 Summary: HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
 Key: CXF-8950
 URL: https://issues.apache.org/jira/browse/CXF-8950
 Project: CXF
  Issue Type: Bug
  Components: JAX-RS
Affects Versions: 4.0.3
Reporter: Sebastian Violet
Assignee: Daniel Kulp
 Fix For: 3.6.3, 4.0.4


When processing requests using the JAX RS client which used the new HttpClient, 
there is a memory leak.

We found this when running it in spring boot using
{code:java}
@Async{code}
 

I have tried to reproduce it using the attached code, and it seems to work with 
a low heap size.

 

You can execute the code like so:
{code:java}
mvn compile exec:exec{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Attachment: CXF-HTTPClient-LargePayload.zip

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is a memory leak.
> We found this when running it in spring boot using
> {code:java}
> @Async{code}
>  
> I have tried to reproduce it using the attached code, and it seems to work 
> with a low heap size.
>  
> You can execute the code like so:
> {code:java}
> mvn compile exec:exec{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Description: 
When processing requests using the JAX RS client which used the new HttpClient, 
there is the input stream is closed prematurely.

 

[In the attached example|^], you will see that we are using {*}Response{*}, 
because we are interested in getting response status as well as the response 
headers. This fails with the following error:
{code:java}
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
closed
    at LargeDataTester.main(LargeDataTester.java:89)
Caused by: java.io.IOException: closed
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
    at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
    at 
org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
    at java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
    at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
    at java.base/java.io.Reader.read(Reader.java:265)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
    at LargeDataTester.main(LargeDataTester.java:84)
Caused by: java.io.IOException: selector manager closed
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
 {code}
 

 

You can execute the code like so:
{code:java}
mvn compile exec:exec{code}

  was:
When processing requests using the JAX RS client which used the new HttpClient, 
there is a memory leak.

We found this when running it in spring boot using
{code:java}
@Async{code}
 

I have tried to reproduce it using the attached code, and it seems to work with 
a low heap size.

 

You can execute the code like so:
{code:java}
mvn compile exec:exec{code}


> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [In the attached example|^], you will see that we are using {*}Response{*}, 
> because we are interested in getting response status as well as the response 
> headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.ni

[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Description: 
When processing requests using the JAX RS client which used the new HttpClient, 
there is the input stream is closed prematurely.

 

 [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
{*}Response{*}, because we are interested in getting response status as well as 
the response headers. This fails with the following error:
{code:java}
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
closed
    at LargeDataTester.main(LargeDataTester.java:89)
Caused by: java.io.IOException: closed
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
    at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
    at 
org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
    at java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
    at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
    at java.base/java.io.Reader.read(Reader.java:265)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
    at LargeDataTester.main(LargeDataTester.java:84)
Caused by: java.io.IOException: selector manager closed
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
 {code}
 

 

You can execute the code like so:
{code:java}
mvn compile exec:exec{code}

  was:
When processing requests using the JAX RS client which used the new HttpClient, 
there is the input stream is closed prematurely.

 

[In the attached example|^], you will see that we are using {*}Response{*}, 
because we are interested in getting response status as well as the response 
headers. This fails with the following error:
{code:java}
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
closed
    at LargeDataTester.main(LargeDataTester.java:89)
Caused by: java.io.IOException: closed
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
    at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
    at 
org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
    at java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
    at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
    at java.base/java.io.Reader.read(Reader.java:265)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
    at LargeDataTester.main(LargeDataTester.java:84)
Caused by: java.io.IOException: selector manager closed
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
    at 
ja

[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Description: 
When processing requests using the JAX RS client which used the new HttpClient, 
there is the input stream is closed prematurely.

 

[^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
{*}Response{*}, because we are interested in getting response status as well as 
the response headers. This fails with the following error:
{code:java}
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
closed
    at LargeDataTester.main(LargeDataTester.java:89)
Caused by: java.io.IOException: closed
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
    at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
    at 
org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
    at java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
    at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
    at java.base/java.io.Reader.read(Reader.java:265)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
    at LargeDataTester.main(LargeDataTester.java:84)
Caused by: java.io.IOException: selector manager closed
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
 {code}
 

{color:#FF}*You can execute the code like so:*{color}
{code:java}
mvn compile exec:exec{code}

ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize the 
object response payload automatically), and the last commit(Using Response).
{code:java}
git diff HEAD^ HEAD {code}

  was:
When processing requests using the JAX RS client which used the new HttpClient, 
there is the input stream is closed prematurely.

 

 [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
{*}Response{*}, because we are interested in getting response status as well as 
the response headers. This fails with the following error:
{code:java}
Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
closed
    at LargeDataTester.main(LargeDataTester.java:89)
Caused by: java.io.IOException: closed
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
    at 
java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
    at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
    at 
org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
    at java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
    at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
    at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
    at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
    at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
    at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
    at java.base/java.io.Reader.read(Reader.java:265)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
    at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
    at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
    at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
    at LargeDataTester.main(LargeDataTester.java:84)
Caused by: java.io.IOException: selector manager closed
    at 
java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException

[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Affects Version/s: 4.0.4

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779372#comment-17779372
 ] 

Sebastian Violet commented on CXF-8950:
---

[~dkulp] and [~reta] since y'all have context.

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779373#comment-17779373
 ] 

Sebastian Violet commented on CXF-8950:
---

If there is a recommendation for how we can get the response header, response 
status and response body without setting the response as {*}Response{*}, please 
do advise; Response being _jakarta.ws.rs.core.Response._

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Resolved] (CXF-8940) ws-security.must-understand works only if security.enable.streaming is true

2023-10-25 Thread Freeman Yue Fang (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Freeman Yue Fang resolved CXF-8940.
---
Fix Version/s: 3.6.3
   4.0.4
   Resolution: Fixed

> ws-security.must-understand works only if security.enable.streaming is true
> ---
>
> Key: CXF-8940
> URL: https://issues.apache.org/jira/browse/CXF-8940
> Project: CXF
>  Issue Type: Bug
>Reporter: Peter Palaga
>Assignee: Freeman Yue Fang
>Priority: Major
> Fix For: 3.6.3, 4.0.4
>
>
> I am unfortunately not sure at all how to reproduce this with plain CXF. If a 
> test is required to demonstrate the issue, I'd be thankful for pointing me to 
> an existing test I could adapt.
> I am able to reproduce this with quarkus-cxf - here are the steps to 
> reproduce:
> {code}
> git clone g...@github.com:ppalaga/quarkus-cxf.git
> cd quarkus-cxf
> git checkout CXF-8940
> mvnd clean install -DskipTests -Dquarkus.build.skip
> cd integration-tests/ws-security-policy
> mvnd clean test 
> -Dtest=UsernameTokenSecurityPolicyTest#helloUsernameTokenNoMustUnderstand
> ...
> [ERROR]   
> UsernameTokenSecurityPolicyTest>AbstractUsernameTokenSecurityPolicyTest.helloUsernameTokenNoMustUnderstand:180
>  
> Expecting actual:
>   "REQ_OUT
> Address: https://localhost:8444/services/helloUsernameToken
> HttpMethod: POST
> Content-Type: text/xml
> ExchangeId: 03fe3642-ab5b-4b85-b712-b8ed107f5a71
> ServiceName: UsernameTokenPolicyHelloService
> PortName: UsernameTokenPolicyHelloServicePort
> PortTypeName: UsernameTokenPolicyHelloService
> Headers: {SOAPAction="", Accept=*/*, Connection=Keep-Alive}
> Payload:  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   
>  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
>  soap:mustUnderstand="1">
>xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
>  wsu:Id="UsernameToken-4e64841c-ad35-48fd-b7ee-70e5f978e098">
> cxf-user
>  Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>secret
>  EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary";>5rs0Ra3q0FPLXFguajlTwQ==
> 2023-10-05T22:40:54.436Z
>   
> 
>   
>   
> http://policy.security.it.cxf.quarkiverse.io/";>
>   helloUsernameTokenNoMustUnderstand
> 
>   
> 
> "
> not to contain:
>   "soap:mustUnderstand="1""
> {code}
> Running the same logic with 
> {{quarkus.cxf.client.helloUsernameTokenNoMustUnderstand.security.enable.streaming
>  = true}} works as expected:
> {code}
> mvnd clean test 
> -Dtest=UsernameTokenSecurityPolicyStaxTest#helloUsernameTokenNoMustUnderstand
> ...
> BUILD SUCCESS
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Violet updated CXF-8950:
--
Priority: Critical  (was: Major)

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779585#comment-17779585
 ] 

Sebastian Violet commented on CXF-8950:
---

This is causing issues in our Production servers. Is there an ETA we can expect 
for the resolution of this? Or for the SNAPSHOT to be updated?

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Daniel Kulp (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779590#comment-17779590
 ] 

Daniel Kulp commented on CXF-8950:
--

Discussing this with [~reta], we don't believe this is a valid bug.   You are 
specifically closing the client (in the try with resources block) but then 
continuing to use objects (the Response) that are expecting the client to still 
be open/connected.You need to be fully done with the client prior to 
calling close (or don't call close and allow the garbage collector to clean it 
up, but that would not be deterministic as to when that would happen).  Or 
re-use the clients (which would have other benefits with keep-alives, http/2, 
etc..).  

When closing the client, all resources associated with that client are no 
longer valid.  You would definitely need to fully consume the entity prior to 
closing the client.  

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779610#comment-17779610
 ] 

Sebastian Violet commented on CXF-8950:
---

I see.

Let me try that.

 

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779629#comment-17779629
 ] 

Sebastian Violet commented on CXF-8950:
---

This was working in the past since we were using the URLConnection conduit, and 
that doesn't have auto closable.

Makes sense.

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779631#comment-17779631
 ] 

Sebastian Violet commented on CXF-8950:
---

Adjusting our code so that we don't immediately close out the client if it is a 
response object.

 

Thank you for your assistance.

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
>     at 
> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
>     at java.base/java.io.FilterInputStream.read(FilterInputStream.java:119)
>     at 
> org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientFilteredInputStream.read(HttpClientHTTPConduit.java:422)
>     at 
> java.base/java.io.SequenceInputStream.read(SequenceInputStream.java:197)
>     at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:333)
>     at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:376)
>     at java.base/sun.nio.cs.StreamDecoder.lockedRead(StreamDecoder.java:219)
>     at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:173)
>     at java.base/java.io.InputStreamReader.read(InputStreamReader.java:189)
>     at java.base/java.io.Reader.read(Reader.java:265)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1610)
>     at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1589)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1384)
>     at org.apache.commons.io.IOUtils.copy(IOUtils.java:1153)
>     at org.apache.commons.io.IOUtils.toString(IOUtils.java:3105)
>     at LargeDataTester.main(LargeDataTester.java:84)
> Caused by: java.io.IOException: selector manager closed
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.selectorClosedException(HttpClientImpl.java:1061)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.closeSubscribers(HttpClientImpl.java:552)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.stop(HttpClientImpl.java:543)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.shutdown(HttpClientImpl.java:1165)
>     at 
> java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1364)
>  {code}
>  
> {color:#FF}*You can execute the code like so:*{color}
> {code:java}
> mvn compile exec:exec{code}
> ℹ️ {*}Note{*}: You can do a diff between what works(Letting CXF deserialize 
> the object response payload automatically), and the last commit(Using 
> Response).
> {code:java}
> git diff HEAD^ HEAD {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CXF-8950) HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT

2023-10-25 Thread Sebastian Violet (Jira)


[ 
https://issues.apache.org/jira/browse/CXF-8950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17779693#comment-17779693
 ] 

Sebastian Violet commented on CXF-8950:
---

Made the following changes to the code and it works well. I have it delay 
closing the client if the return type is {*}Response{*}:
{code:java}
diff --git a/pom.xml b/pom.xml
index 375dd56..41ed82b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,6 +81,15 @@
 
   
     
+      
+        org.apache.maven.plugins
+        maven-compiler-plugin
+        
+          
+            --enable-preview
+          
+        
+      
       
         org.codehaus.mojo
         exec-maven-plugin
@@ -95,9 +104,7 @@
 
           java
           
-            -Xmx512m
-            -XX:+HeapDumpOnOutOfMemoryError
-            -XX:HeapDumpPath=/tmp
+            --enable-preview
             -classpath
             
             LargeDataTester
diff --git a/src/main/java/LargeDataTester.java 
b/src/main/java/LargeDataTester.java
index 2900f08..0aa50df 100644
--- a/src/main/java/LargeDataTester.java
+++ b/src/main/java/LargeDataTester.java
@@ -21,6 +21,9 @@ import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Function;
 import lombok.AccessLevel;
 import lombok.AllArgsConstructor;
@@ -75,7 +78,7 @@ public class LargeDataTester {
     try {
       final DataServiceImpl statusServiceClient = 
DataServiceImpl.builder().apiUrl(endpoint).build();
 
-      Response response = statusServiceClient.data();
+      Response response = statusServiceClient.dataRaw();
 
       log.info("Response Status is: {}", response.getStatus());
       response.getHeaders().forEach((s, objects) -> log.info("Response Header, 
{}: {}", s, objects));
@@ -127,7 +130,11 @@ public class LargeDataTester {
     // ---
     @GET
     @Path("data")
-    Response data();
+    Response dataRaw();
+
+    @GET
+    @Path("data")
+    Data data();
   }
 
   @Builder
@@ -146,21 +153,39 @@ public class LargeDataTester {
         .noBackoff()
         .build(); //No retries
 
+    private final ExecutorService executorService = 
Executors.newVirtualThreadPerTaskExecutor();
+
     private  T doWithRetry(Function functionToRetry) {
       return this.doWithRetry(functionToRetry, this.retryTemplate);
     }
 
     private  T doWithRetry(Function functionToRetry, 
RetryTemplate templateToUse) {
       DataService service = this.getService();
+      final AtomicBoolean isResponse = new AtomicBoolean(false);
       try {
-        return templateToUse.execute(retryContext -> 
functionToRetry.apply(service));
+        T response = templateToUse.execute(retryContext -> 
functionToRetry.apply(service));
+        isResponse.set(response instanceof Response);
+        return response;
       } finally {
-        WebClient.client(service).close();
+        executorService.execute(() -> {
+          try {
+            // Allow enough time for the input stream to be read by consumer 
of Response
+            if(isResponse.get()) {
+              Thread.sleep(6);
+            }
+          } catch (InterruptedException e) {}
+          WebClient.client(service).close();
+        });
       }
     }
 
     @Override
-    public Response data() {
+    public Response dataRaw() {
+      return this.doWithRetry(service -> service.dataRaw());
+    }
+
+    @Override
+    public Data data() {
       return this.doWithRetry(service -> service.data());
     }
{code}
ℹ️ {*}Note{*}: This uses Java 20 virtual threads to reduce overhead of platform 
threads.

> HttpClient in CXF closing prematurely; 4.0.4-SNAPSHOT
> -
>
> Key: CXF-8950
> URL: https://issues.apache.org/jira/browse/CXF-8950
> Project: CXF
>  Issue Type: Bug
>  Components: JAX-RS
>Affects Versions: 4.0.3, 4.0.4
>Reporter: Sebastian Violet
>Assignee: Daniel Kulp
>Priority: Critical
> Fix For: 3.6.3, 4.0.4
>
> Attachments: CXF-HTTPClient-LargePayload.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is the input stream is closed prematurely.
>  
> [^CXF-HTTPClient-LargePayload.zip] , you will see that we are using 
> {*}Response{*}, because we are interested in getting response status as well 
> as the response headers. This fails with the following error:
> {code:java}
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> closed
>     at LargeDataTester.main(LargeDataTester.java:89)
> Caused by: java.io.IOException: closed
>     at 
> java.net.http/jdk.internal.net.http.Respo

[jira] [Updated] (CXF-8940) ws-security.must-understand works only if security.enable.streaming is true

2023-10-25 Thread Andriy Redko (Jira)


 [ 
https://issues.apache.org/jira/browse/CXF-8940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy Redko updated CXF-8940:
--
Fix Version/s: 3.5.8

> ws-security.must-understand works only if security.enable.streaming is true
> ---
>
> Key: CXF-8940
> URL: https://issues.apache.org/jira/browse/CXF-8940
> Project: CXF
>  Issue Type: Bug
>Reporter: Peter Palaga
>Assignee: Freeman Yue Fang
>Priority: Major
> Fix For: 3.5.8, 3.6.3, 4.0.4
>
>
> I am unfortunately not sure at all how to reproduce this with plain CXF. If a 
> test is required to demonstrate the issue, I'd be thankful for pointing me to 
> an existing test I could adapt.
> I am able to reproduce this with quarkus-cxf - here are the steps to 
> reproduce:
> {code}
> git clone g...@github.com:ppalaga/quarkus-cxf.git
> cd quarkus-cxf
> git checkout CXF-8940
> mvnd clean install -DskipTests -Dquarkus.build.skip
> cd integration-tests/ws-security-policy
> mvnd clean test 
> -Dtest=UsernameTokenSecurityPolicyTest#helloUsernameTokenNoMustUnderstand
> ...
> [ERROR]   
> UsernameTokenSecurityPolicyTest>AbstractUsernameTokenSecurityPolicyTest.helloUsernameTokenNoMustUnderstand:180
>  
> Expecting actual:
>   "REQ_OUT
> Address: https://localhost:8444/services/helloUsernameToken
> HttpMethod: POST
> Content-Type: text/xml
> ExchangeId: 03fe3642-ab5b-4b85-b712-b8ed107f5a71
> ServiceName: UsernameTokenPolicyHelloService
> PortName: UsernameTokenPolicyHelloServicePort
> PortTypeName: UsernameTokenPolicyHelloService
> Headers: {SOAPAction="", Accept=*/*, Connection=Keep-Alive}
> Payload:  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   
>  xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
>  soap:mustUnderstand="1">
>xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
>  wsu:Id="UsernameToken-4e64841c-ad35-48fd-b7ee-70e5f978e098">
> cxf-user
>  Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>secret
>  EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary";>5rs0Ra3q0FPLXFguajlTwQ==
> 2023-10-05T22:40:54.436Z
>   
> 
>   
>   
> http://policy.security.it.cxf.quarkiverse.io/";>
>   helloUsernameTokenNoMustUnderstand
> 
>   
> 
> "
> not to contain:
>   "soap:mustUnderstand="1""
> {code}
> Running the same logic with 
> {{quarkus.cxf.client.helloUsernameTokenNoMustUnderstand.security.enable.streaming
>  = true}} works as expected:
> {code}
> mvnd clean test 
> -Dtest=UsernameTokenSecurityPolicyStaxTest#helloUsernameTokenNoMustUnderstand
> ...
> BUILD SUCCESS
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)