Oleg,
realistically I would expect the default timeout to be around 5 seconds, as is
the default value in the PoolingHttpClientConnectionManager (
https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/PoolingHttpClientConnectionManager.java).
IIRC, it was 2 seconds in the 4.4 release. To me, for an http call 3 minutes
looks like an eternity. But that's just my opinion.
I've made a small example:
https://github.com/jihor/async-http-client-notimeout-demo
In the demo project, HttpAsyncClient 4.1.3 is used.
The example runs 2 http post's (one without timeout, the other with a timeout)
on each of the following clients:
- (sync) client with default configuration (HttpClients.createDefault()). This
client will wait endlessly if no timeout is defined in the request;
- (sync) client with custom RequestConfig. This client will always exit after
its timeout expires even if the request has no timeout defined;
- asyncClient with default configuration (HttpAsyncClients.createDefault()).
This client will wait endlessly if no timeout is defined in the request;
- asyncClient with custom connection manager and custom ioReactor. This client
will always exit after its timeout expires even if the request has no timeout
defined.
To me, it seems like a pitfall that default configurations offer unlimited
timeouts for the requests which don't request specific timeouts using request
configs.
Regards, Dmitry Zhikharev
On May 16, 2018, 17:02, at 17:02, Oleg Kalnichevski <ol...@apache.org> wrote:
>On Wed, 2018-05-16 at 15:16 +0300, Дмитрий Жихарев wrote:
>> Hi all!
>>
>> I was wondering if the IOReactorConfig.DEFAULT intentionally has
>> soTimeout set to ZERO_MILLESECONDS. Before version 5 there was also
>> connectTimeout, which also was 0 for the default builder. I
>> understand that the library can't make up its own mind on what
>> timeout the user requires, but isn't it a good practice for the
>> default config to have some sensible defaults so it doesn't hang
>> forever if something goes wrong?
>>
>> Regards, Dmitry Zhikharev
>>
>
>Hi Dmitry
>
>HttpClient 5.0 already uses finite (3 min) timeout values for connect
>and connection request operations.
>
>
>https://github.com/apache/httpcomponents-client/blob/master/httpclient5
>/src/main/java/org/apache/hc/client5/http/config/RequestConfig.java#L44
>
>It is more difficult to say what the default value of socket timeout
>should be as different application might have different expectations
>and operational assumptions.
>
>What kind of value would you propose?
>
>Oleg
>
>-
>To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
>For additional commands, e-mail: httpclient-users-h...@hc.apache.org
-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org