[jira] [Commented] (CXF-8282) Set read timeout using netty client

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (CXF-8282) Set read timeout using netty client

Omar Atia (Jira)

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

Santiago Orcajo commented on CXF-8282:
--------------------------------------

Hi [~reta],

Thanks for your quick response. I have tried the 3.3.7-SNAPSHOT version and it works when the read timeout is surpassed. However, when a response does not surpass the read timeout I can see the following lines in my console logs:
{code:java}
WARN  io.netty.channel.AbstractChannelHandlerContext -  An exception 'java.lang.NullPointerException' [enable DEBUG level for full stacktrace] was thrown by a user handler's exceptionCaught() method while handling the following exception:
io.netty.handler.timeout.ReadTimeoutException: null
{code}
The NpE is thrown when the read timeout is surpassed (without take in account if the server has returned a response or not). I think the exception is provoked due to the following lines of the exceptionCaught method in the NettyHttpClientHandler class:
{code:java}
            final NettyHttpClientRequest request = sendedQueue.poll();
            request.getCxfResponseCallback().error(new IOException(cause));
{code}
Could it happen due to the ChannelHandlerContext object is not closed? The method channelReadComplete of the NettyHttpClientHandler could close the channel if it is set on this way:
{code:java}
    @Override
    public void channelReadComplete(final ChannelHandlerContext ctx) throws Exception {
        ctx.flush();
        //Now, we close the channel:
        ctx.close();
    }
{code}
I guess it could be a solution. What do you think?

Thank you,

Santiago

> Set read timeout using netty client
> -----------------------------------
>
>                 Key: CXF-8282
>                 URL: https://issues.apache.org/jira/browse/CXF-8282
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 3.3.6, 3.2.13
>            Reporter: Santiago Orcajo
>            Assignee: Andriy Redko
>            Priority: Major
>              Labels: cxf, jax-ws,, netty, timeout
>             Fix For: 3.4.0, 3.2.14, 3.3.7
>
>
> Hi,
> I am using cxf-rt-transports-http-netty-client (3.3.6) in order to set a client generated by jaxws using the Netty configuration. I want to set a read timeout in my client configuration because the server's response time is ocasionally too long.
> Connection timeout and Receive timeout are correctly set in the NettyHttpConduit but it looks like the read timeout can not be set. 
> My client configuration is set as follows:
>  
> {code:java}
> Object client = (new JaxWsProxyFactoryBean()).create();
> final Client clientProxy = ClientProxy.getClient(client);
> final HTTPConduit httpConduit = (HTTPConduit) clientProxy.getConduit();
> final HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();            
> httpClientPolicy.setAsyncExecuteTimeout(connectTimeout.toMillis());
> httpClientPolicy.setConnectionTimeout(connectTimeout.toMillis());
> httpClientPolicy.setReceiveTimeout(readTimeout.toMillis());
> httpConduit.setClient(httpClientPolicy);
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)