On Tue, 2026-01-13 at 14:49 +0100, Oleg Kalnichevski wrote:
> 
> 
> On 01/13/2026 14:11, Vardin. Angel wrote:
> > Hello,
> > Thank you for the provided information. My implementation contains
> > logic that cleans expired connections every 10 seconds. To verify
> > the correct timeout value, I checked the default logic in the
> > HttpClientBuilder, which cleans both expired and idle connections.
> > As far as I can see, this is implemented in the
> > IdleConnectionEvictor thread (see links below):
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/IdleConnectionEvictor.java#L56
> >  
> > https://github.com/apache/httpcomponents-client/blob/master/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java#L1118
> > You mentioned in your response that the timeout for expited
> > connections cleaning should not be less than one minute. However,
> > in the IdleConnectionEvictor, the default timeout is 5 seconds if
> > no value is specified. Additionally, if evictIdleConnections is not
> > configured, the timeout defaults seems to be 1 second.
> 
> We had extreme cases with people trying to call the damn method every
> few milliseconds. A safe-guard has been introduced to ensure the
> sleep 
> interval could not be less than a second. The patch had a bug in it
> that 
> I had overlooked. The default should have never been 1 sec.
> 
> In the normal course of operations when the pool is reasonably busy
> it 
> will evict expired connections as it encounters them. The idle
> evictor 
> thread is needed only if there _long_ periods of inactivity. One
> minute 
> sweep should be perfectly sufficient, Or 30 seconds. Anything below 5
> seconds is outright crazy but we still allow it in case someone
> really 
> has reasons for that.
> 
> I will address the problem with IdleConnectionEvictor defaults, but 
> there unlikely to be changes to the logging granularity.
> 

Hi Angel

Please see the proposed fix

https://github.com/apache/httpcomponents-client/pull/789

Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to