cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Communier (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-5559) Async jaxrs call : Inifinite loop when connexion socket timeout /connexion refused occurs and no action can stop this loop
Date Thu, 13 Feb 2014 10:38:19 GMT
Anthony Communier created CXF-5559:
--------------------------------------

             Summary: Async jaxrs call : Inifinite loop when connexion socket timeout /connexion
refused occurs and no action can stop this loop
                 Key: CXF-5559
                 URL: https://issues.apache.org/jira/browse/CXF-5559
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 2.7.8
         Environment: Windows & Linux Red Hat 6.4
            Reporter: Anthony Communier
            Priority: Critical


When an async request failed due to connexion timeout, callback is infinitly called. 

Exception thrown on connection error :
javax.ws.rs.client.ClientException: javax.ws.rs.client.ClientException: java.net.ConnectException:
Connection refused

Analysis : In class HTTPConduit
1/ handleResponseOnWorkqueue:Runnable call handleResponseInternal();
2/ An exception is thrown because connexion timeout occurs
3/ Call back is called (method InvocationCallback:failed(ClientException error))
4/ No executor in method handleResponseOnWorkqueue is set so it execute a new runnable. =>I
think it miss something to check if an exception was thrown

I tried to : 
- cancel FutureTask in callback and in a different thread
- Interrupt the current thread in the callback
- Throw Runtime exception in order to break execution
But it creates a new task before ending the execution.

The only way I found to stop the loop was to patch : handleResponseOnWorkqueue and test if
an exception was set before trying to execute something


Stack trace of the loop :

javax.ws.rs.client.ClientException: javax.ws.rs.client.ClientException: java.net.ConnectException:
Connection refused
        at org.apache.cxf.jaxrs.client.JaxrsClientCallback.handleException(JaxrsClientCallback.java:90)
[cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:980) [cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.WebClient.access$100(WebClient.java:77) [cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.WebClient$ClientAsyncResponseInterceptor.handleMessage(WebClient.java:1241)
[cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
[cxf-api-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.ClientMessageObserver.onMessage(ClientMessageObserver.java:56)
[cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1138)
[cxf-rt-transports-http-2.7.8.jar:2.7.8]
        at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428)
[cxf-api-2.7.8.jar:2.7.8]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
[na:1.7.0_09-icedtea]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
[na:1.7.0_09-icedtea]
        at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353)
[cxf-api-2.7.8.jar:2.7.8]
        at java.lang.Thread.run(Thread.java:722) [na:1.7.0_09-icedtea]
Caused by: javax.ws.rs.client.ClientException: java.net.ConnectException: Connection refused
        at org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:575)
~[cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:557)
~[cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        at org.apache.cxf.jaxrs.client.WebClient.handleAsyncResponse(WebClient.java:971) [cxf-rt-frontend-jaxrs-2.7.8.jar:2.7.8]
        ... 10 common frames omitted
Caused by: java.net.ConnectException: Connection refused
        at sun.reflect.GeneratedConstructorAccessor27.newInstance(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
~[na:1.7.0_09-icedtea]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525) ~[na:1.7.0_09-icedtea]
        at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1664)
~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1662)
~[na:na]
        at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_09-icedtea]
        at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1660)
~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1243)
~[na:na]
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) ~[na:1.7.0_09-icedtea]
        at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:266)
~[cxf-rt-transports-http-2.7.8.jar:2.7.8]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1530)
~[cxf-rt-transports-http-2.7.8.jar:2.7.8]
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1129)
[cxf-rt-transports-http-2.7.8.jar:2.7.8]
        ... 5 common frames omitted
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_09-icedtea]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_09-icedtea]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
~[na:1.7.0_09-icedtea]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_09-icedtea]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) ~[na:1.7.0_09-icedtea]
        at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_09-icedtea]
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[na:na]
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:378) ~[na:na]
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:473) ~[na:na]
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:203) ~[na:na]
        at sun.net.www.http.HttpClient.New(HttpClient.java:290) ~[na:na]
        at sun.net.www.http.HttpClient.New(HttpClient.java:306) ~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:995)
~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:849)
~[na:na]
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
~[na:na]



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message