cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Fwd: Timeouts not being used?
Date Fri, 12 Feb 2016 10:14:56 GMT
Hi David

Is the receive timeout larger than the connection one, can you set it to 
the same value as the receive timeout ?

The conduit simply sets these properties on HttpUrlConnection:

https://github.com/apache/cxf/blob/master/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java#L120

Please also experiment with different HTTP verbs, GET vs POST for ex, 
I'd not be surprised if it were having some effect.

Finally, how about trying the HttpUrlConnection timeouts directly, 
without CXF ?

Cheers, Sergey
On 12/02/16 06:23, David Karlsen wrote:
> Cross posting dev since I got no response from users
> ---------- Videresendt melding ----------
> Fra: "David Karlsen" <davidkarlsen@gmail.com>
> Dato: 8. feb. 2016 10:05
> Emne: Timeouts not being used?
> Til: <users@cxf.apache.org>
> Kopi:
>
> I am getting an instance of my JAX-RS stub/iface like this:
>
> private DeployApi getDeployApi( int timeoutInSeconds )
> {
>      DeployApi deployApi = JAXRSClientFactory.create(
> apiBaseAddress.toExternalForm(), DeployApi.class );
>      ClientConfiguration clientConfiguration = WebClient.getConfig(
> deployApi );
>      clientConfiguration.getInInterceptors().add( new LoggingInInterceptor()
> );
>      clientConfiguration.getOutInterceptors().add( new
> LoggingOutInterceptor() );
>      HTTPConduit httpConduit = clientConfiguration.getHttpConduit();
>      HTTPClientPolicy httpClientPolicy = httpConduit.getClient();
>      httpClientPolicy.setAllowChunking( false );
>      httpClientPolicy.setConnectionTimeout( TimeUnit.SECONDS.toMillis( 2 ) );
>      httpClientPolicy.setReceiveTimeout( TimeUnit.SECONDS.toMillis(
> timeoutInSeconds ) );
>      httpClientPolicy.setAutoRedirect( true );
>
>      return deployApi;
> }
>
> But it does not seem to be respected? From the log the timeout seems
> to be two minues (09:51:31-09:53:31)
>
> 09:51:31 --------------------------------------
> 09:53:31 Feb 08, 2016 9:53:31 AM
> org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
> 09:53:31 WARNING: Interceptor for
> {http://maven.adcm.tac.fs.evry.com/}DeployApi has thrown exception,
> unwinding now
> 09:53:31 org.apache.cxf.interceptor.Fault: Could not send Message.
> 09:53:31 at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
> 09:53:31 at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> 09:53:31 at
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:649)
> 09:53:31 at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:714)
> 09:53:31 at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:228)
> 09:53:31 at com.sun.proxy.$Proxy32.deployWithConfig(Unknown Source)
> 09:53:31 at
> com.evry.fs.tac.adcm.maven.DeployService.latestWithConfig(DeployService.java:41)
> 09:53:31 at
> com.evry.fs.tac.adcm.maven.DeployWithConfigurationMojo.doExecute(DeployWithConfigurationMojo.java:62)
> 09:53:31 at
> com.evry.fs.tac.adcm.maven.AbstractAdcmMojo.execute(AbstractAdcmMojo.java:30)
> 09:53:31 at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:185)
> 09:53:31 at
> org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call(MultiThreadedBuilder.java:181)
> 09:53:31 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 09:53:31 at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 09:53:31 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 09:53:31 at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 09:53:31 at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 09:53:31 at java.lang.Thread.run(Thread.java:745)
> 09:53:31 Caused by: java.net.SocketTimeoutException:
> SocketTimeoutException invoking http://10.246.107.6/injector: Read
> timed out
> 09:53:31 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> 09:53:31 at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> 09:53:31 at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 09:53:31 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1376)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1360)
> 09:53:31 at
> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
> 09:53:31 at
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:215)
> 09:53:31 at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
> 09:53:31 at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> 09:53:31 ... 21 more
> 09:53:31 Caused by: java.net.SocketTimeoutException: Read timed out
> 09:53:31 at java.net.SocketInputStream.socketRead0(Native Method)
> 09:53:31 at
> java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
> 09:53:31 at java.net.SocketInputStream.read(SocketInputStream.java:170)
> 09:53:31 at java.net.SocketInputStream.read(SocketInputStream.java:141)
> 09:53:31 at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
> 09:53:31 at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
> 09:53:31 at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
> 09:53:31 at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)
> 09:53:31 at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
> 09:53:31 at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536)
> 09:53:31 at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
> 09:53:31 at
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
> 09:53:31 at
> org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:332)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1577)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1606)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1550)
> 09:53:31 at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1347)
> 09:53:31 ... 26 more
> 09:53:31
>
>
>
> --
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Mime
View raw message