Kiyoshi Iwasaki created HTTPCLIENT-2399:
-------------------------------------------
Summary: The IdleConnectionEvictor is performing a potentially
blocking I/O operation while holding a global lock on the pool
Key: HTTPCLIENT-2399
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2399
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient (classic)
Affects Versions: 5.5, 5.4.4
Reporter: Kiyoshi Iwasaki
Hi all
Please excuse any awkward phrasing in my message, as I am not a native English
speaker and am using translation software.
In HttpClient 5.4.3, I encountered a problem where the IdleConnectionEvictor
thread would freeze while holding a lock on the StrictConnPool, making it
impossible to obtain a connection. This issue has already been resolved in
5.4.4 and later; however, it remains a concern that the IdleConnectionEvictor
is performing a potentially blocking I/O operation while holding a global lock
on the pool.
Here is a portion of the stack trace that occurred when it actually froze in
version 5.4.3.
{code}
"idle-connection-evictor-1" #326 daemon prio=5 ... runnable ...
java.lang.Thread.State: RUNNABLE
....
at
sun.security.ssl.SSLSocketImpl.close([email protected]/SSLSocketImpl.java:584)
at org.apache.hc.core5.io.Closer.close(Closer.java:48)
at org.apache.hc.core5.io.Closer.closeQuietly(Closer.java:71)
at
org.apache.hc.core5.http.impl.io.BHttpConnectionBase.close(BHttpConnectionBase.java:268)
at
org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.close(DefaultBHttpClientConnection.java:71)
at
org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection.close(DefaultManagedHttpClientConnection.java:176)
at org.apache.hc.core5.pool.PoolEntry.discardConnection(PoolEntry.java:180)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.closeIfExpired(PoolingHttpClientConnectionManager.java:650)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1.lambda$closeExpired$0(PoolingHttpClientConnectionManager.java:228)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1$$Lambda$3021/0x00007f03a26afb60.execute(Unknown
Source)
at
org.apache.hc.core5.pool.StrictConnPool.enumAvailable(StrictConnPool.java:590)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$1.closeExpired(PoolingHttpClientConnectionManager.java:228)
at
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.closeExpired(PoolingHttpClientConnectionManager.java:542)
at
org.apache.hc.client5.http.impl.IdleConnectionEvictor.lambda$new$0(IdleConnectionEvictor.java:61)
at
org.apache.hc.client5.http.impl.IdleConnectionEvictor$$Lambda$2977/0x00007f03a2686b48.run(Unknown
Source)
at java.lang.Thread.run([email protected]/Thread.java:840)
{code}
The `StrictConnPool.enumAvailable()` method executes the callback argument
while holding the global lock on the pool.
Finally, the `Socket.close()` method (a potentially blocking I/O operation) is
called via `Closer.close()`.
I asked about this on the mailing list and received the following response:
"This is wrong and needs to be fixed. Please raise a JIRA for this defect."
* Mailing list: [email protected]
* Date: September 11
* Title: IdleConnectionEvictor freezes when holding a StrictConnPool lock in
HttpClient 5.4.3
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]