Dmitry Potapov created HTTPCLIENT-1497:
------------------------------------------
Summary: Allow to enable SO_LINGER option with zero timeout
Key: HTTPCLIENT-1497
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1497
Project: HttpComponents HttpClient
Issue Type: Improvement
Components: HttpClient
Affects Versions: 4.3.3
Reporter: Dmitry Potapov
Attachments: httpclient-enable-linger.patch
According to
http://docs.oracle.com/javase/8/docs/api/java/net/StandardSocketOptions.html#SO_LINGER
linger option is disabled by default. Currently if SocketConfig.soLinger is
set to zero (default value is -1), then Socket.setSoLinger(false, 0) will be
called, so linger will be disabled, which is undesirable. Zero SO_LINGER
timeout is the essential feature for HttpClient, without it we will fall into
one of two options:
1. With disabled SO_LINGER all system sockets can fall into TIME_WAIT status
and client will stuck
2. With enabled non-zero SO_LINGER client will wait up to 1 second at
AbstractConnPool.getPoolEntryBlocking (Line 230) while closing expired
connections under lock (this lock is already held by PoolingEntryFuture.get(),
so there is no quick fix to release this lock for other threads)
I had encountered both of these issues on live systems.
I understand that this change will break backward compatibility of config
interpretation, but can we have this in 4.4?
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]