Hi Sergey,

Thanks, and just add a test in JAXRSAsyncClientTest to verify the 
receiveTimeout configuration works for the jaxrs async invocation with ahc[1]

[1]http://git-wip-us.apache.org/repos/asf/cxf/commit/17c7ebc8 
<http://git-wip-us.apache.org/repos/asf/cxf/commit/17c7ebc8>

Hi Veit,

Could you please provide a runnable testcase as we can’t reproduce this on our 
side. You can create a jira ticket and attach your testcase there.

Thanks
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



> On Jan 12, 2017, at 9:52 PM, Sergey Beryozkin <[email protected]> wrote:
> 
> Hi Freeman, thanks, try either JAXWS or JAXRS end to end system sync test 
> (ex, JAXRSAsyncClientTest) where a 'use.async.conduit' is set as a property
> 
> Cheers, Sergey
> On 12/01/17 13:46, Freeman Fang wrote:
>> Hi Sergey,
>> 
>> With  CXF-7122, we found that with ahc 4.1.0 afterwards, the
>> ReceivedTimeout we set on ahc RequestConfig won't affect the connection
>> return to the pool, so that the connection could be actually reused. So
>> that CXF can rely on ahc to manage the ReceivedTimeout and don’t need
>> that TimeoutThread(Timer) in CXF, so we remove that Timer in CXF-7122.
>> 
>> And we actually have AsyncHTTPConduitTest#testTimeout
>> and AsyncHTTPConduitTest#testTimeoutAsync to cover both the sync and
>> async calls
>> 
>> @Test
>>    public void testTimeout() throws Exception {
>>        updateAddressPort(g, PORT);
>>        HTTPConduit c = (HTTPConduit)ClientProxy.getClient(g).getConduit();
>>        c.getClient().setReceiveTimeout(3000);
>>        try {
>>            assertEquals("Hello " + request, g.greetMeLater(-5000));
>>            fail();
>>        } catch (Exception ex) {
>>            //expected!!!
>>        }
>>    }
>> 
>>    @Test
>>    public void testTimeoutAsync() throws Exception {
>>        updateAddressPort(g, PORT);
>>        HTTPConduit c = (HTTPConduit)ClientProxy.getClient(g).getConduit();
>>        c.getClient().setReceiveTimeout(3000);
>>        try {
>>            Response<GreetMeLaterResponse> future =
>> g.greetMeLaterAsync(-5000L);
>>            future.get();
>>            fail();
>>        } catch (Exception ex) {
>>            //expected!!!
>>        }
>>    }
>> 
>> Not sure what’s the real problem Veit run into, I will try to reproduce
>> the error.
>> -------------
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> 
>> 
>> 
>>> On Jan 12, 2017, at 8:42 PM, Sergey Beryozkin <[email protected]
>>> <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>> 
>>> Hi Veit,
>>> 
>>> I recall there was another update related to introducing a
>>> TimeoutThread, the async conduit was ignoring the receiveTimeout for
>>> the async calls.
>>> 
>>> Hi Freeman, looks like that change affected the use of the async
>>> conduit for the sync calls (this would affect both JAXWS & JAXRS), can
>>> you double check please
>>> 
>>> Thanks, Sergey
>>> 
>>> 
>>> On 03/01/17 17:09, Veit Guna wrote:
>>>> Hi.
>>>> 
>>>> I just upgraded from 3.1.8 to 3.1.9 with the effect, that one of my
>>>> tests is failing now regarding the receiveTimeout set on
>>>> HTTPClientPolicy.
>>>> I'm currently using CXF for JAX-RS client side proxy generation based on
>>>> my REST server interfaces. I'm also using the "use.async.http.conduit"
>>>> switch
>>>> to use the async http conduit.
>>>> 
>>>> The test is setting the receiveTimeout on the HTTPClientPolicy to 1 (ms)
>>>> like this:
>>>> 
>>>> JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
>>>> ...
>>>> MyService myService = bean.create(MyService.class);
>>>> ClientConfiguration clientConfig = WebClient.getConfig(myService);
>>>> clientConfig.getResponseContext().put("buffer.proxy.response",
>>>> cacheResponses);
>>>> clientConfig.getRequestContext().put("use.async.http.conduit", true);
>>>> 
>>>> HTTPClientPolicy clientPolicy =
>>>> clientConfig.getHttpConduit().getClient();
>>>> cllientPolicy.setReceiveTimeout(receiveTimeoutMillis);
>>>> clientPolicy.setConnectionTimeout(connectionTimeoutMillis);
>>>> 
>>>> Then it calls a status REST endpoint and expects a ProcessingException
>>>> to be thrown. But this is never thrown and the call succeeds.
>>>> In the past it failed as expected. I also switched to another endpoint
>>>> that takes a bit longer to respond but with the same effect.
>>>> Going back to 3.1.8 fixes the issue.
>>>> 
>>>> I took a look at the recent changes and found this:
>>>> 
>>>> https://issues.apache.org/jira/browse/CXF-7122
>>>> 
>>>> Maybe it is related to it?
>>>> 
>>>> Thanks!
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Sergey Beryozkin
>>> 
>>> Talend Community Coders
>>> http://coders.talend.com/
>> 
> 
> 
> -- 
> Sergey Beryozkin
> 
> Talend Community Coders
> http://coders.talend.com/ <http://coders.talend.com/>

Reply via email to