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

Dennis updated CXF-8992:
------------------------
    Description: 
The following code throws an exception, probably because when one WebClient 
instance is finalized, it also closes its transport, which is reused by other 
instances.

For URLs that don’t use HTTP2, a timeout exception is thrown instead, probably 
due to the same reason.

Is this a bug or am I using it incorrectly?
{code:java}
WebClient c = WebClient.create("https://www.google.com";);
 
System.out.println(WebClient.fromClient(c).get().getStatus());

System.gc();
 
// java.io.EOFException: EOFException invoking https://www.google.com: HTTP/2 
client stopped
System.out.println(WebClient.fromClient(c).get().getStatus());
{code}

The same can also be reproduced using JAX RS WebTarget API:

{code:java}
WebTarget webTarget = 
ClientBuilder.newClient().target("https://www.google.com";);

System.out.println(webTarget.request().get().getStatus());

System.gc();

// java.io.EOFException: EOFException invoking https://www.google.com: HTTP/2 
client stopped
System.out.println(webTarget.request().get().getStatus());
{code}

  was:
The following code throws an exception, probably because when one WebClient 
instance is finalized, it also closes its transport, which is reused by other 
instances.

For URLs that don’t use HTTP2, a timeout exception is thrown instead, probably 
due to the same reason.

Is this a bug or am I using it incorrectly?
{code:java}
WebClient c = WebClient.create("https://www.google.com";);
 
System.out.println(WebClient.fromClient(c).get().getStatus());

System.gc();
 
// java.io.EOFException: EOFException invoking https://www.google.com: HTTP/2 
client stopped
System.out.println(WebClient.fromClient(c).get().getStatus());
{code}


> WebClient.fromClient() broken due to garbage collection
> -------------------------------------------------------
>
>                 Key: CXF-8992
>                 URL: https://issues.apache.org/jira/browse/CXF-8992
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 4.0.4
>            Reporter: Dennis
>            Priority: Major
>
> The following code throws an exception, probably because when one WebClient 
> instance is finalized, it also closes its transport, which is reused by other 
> instances.
> For URLs that don’t use HTTP2, a timeout exception is thrown instead, 
> probably due to the same reason.
> Is this a bug or am I using it incorrectly?
> {code:java}
> WebClient c = WebClient.create("https://www.google.com";);
>  
> System.out.println(WebClient.fromClient(c).get().getStatus());
> System.gc();
>  
> // java.io.EOFException: EOFException invoking https://www.google.com: HTTP/2 
> client stopped
> System.out.println(WebClient.fromClient(c).get().getStatus());
> {code}
> The same can also be reproduced using JAX RS WebTarget API:
> {code:java}
> WebTarget webTarget = 
> ClientBuilder.newClient().target("https://www.google.com";);
> System.out.println(webTarget.request().get().getStatus());
> System.gc();
> // java.io.EOFException: EOFException invoking https://www.google.com: HTTP/2 
> client stopped
> System.out.println(webTarget.request().get().getStatus());
> {code}



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

Reply via email to