hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Kull (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1453) PoolingHttpClientConnectionManager thread safety
Date Tue, 11 Mar 2014 12:32:43 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13930281#comment-13930281
] 

Markus Kull commented on HTTPCLIENT-1453:
-----------------------------------------

Just for the info, if anyone is googling a stacktrace: This fix also seems to prevent this
IllegalStateException in PoolingClientConnectionManager.

java.lang.IllegalStateException: Entry [id:34759][route:{}->http://localhost:57340][state:null]
has not been leased from this pool
	at org.apache.http.util.Asserts.check(Asserts.java:40) ~[httpcore-4.3.1.jar:4.3.1]
	at org.apache.http.pool.RouteSpecificPool.free(RouteSpecificPool.java:123) ~[httpcore-4.3.1.jar:4.3.1]
	at org.apache.http.pool.AbstractConnPool.release(AbstractConnPool.java:308) ~[httpcore-4.3.1.jar:4.3.1]
	at org.apache.http.impl.conn.PoolingClientConnectionManager.releaseConnection(PoolingClientConnectionManager.java:266)
~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.impl.conn.ManagedClientConnectionImpl.releaseConnection(ManagedClientConnectionImpl.java:440)
~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.conn.BasicManagedEntity.releaseManagedConnection(BasicManagedEntity.java:201)
~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.conn.BasicManagedEntity.streamClosed(BasicManagedEntity.java:176) ~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:227) ~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174) ~[httpclient-4.3.2.jar:4.3.2]
	at org.apache.http.util.EntityUtils.consume(EntityUtils.java:88) ~[httpcore-4.3.1.jar:4.3.1]

indirectly caused by

java.util.ConcurrentModificationException: null
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:926) ~[na:1.7.0_51]
	at java.util.HashMap$EntryIterator.next(HashMap.java:966) ~[na:1.7.0_51]
	at java.util.HashMap$EntryIterator.next(HashMap.java:964) ~[na:1.7.0_51]
	at org.apache.http.pool.AbstractConnPool.purgePoolMap(AbstractConnPool.java:469) ~[httpcore-4.3.1.jar:4.3.1]
	at org.apache.http.pool.AbstractConnPool.closeIdle(AbstractConnPool.java:500) ~[httpcore-4.3.1.jar:4.3.1]
	at org.apache.http.impl.conn.PoolingClientConnectionManager.closeIdleConnections(PoolingClientConnectionManager.java:288)
~[httpclient-4.3.2.jar:4.3.2]


> PoolingHttpClientConnectionManager thread safety
> ------------------------------------------------
>
>                 Key: HTTPCLIENT-1453
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1453
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpConn
>    Affects Versions: 4.3.2
>         Environment: Windows 8.1 x64
> java version "1.7.0_45"
> Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
> Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
>            Reporter: Rahim Alizada
>             Fix For: 4.3.3
>
>
> Although the PoolingHttpClientConnectionManager is marked as ThreadSafe, connectionManager.closeExpiredConnections()
call from multiple threads causes ConcurrentModificationException.
> java.util.ConcurrentModificationException
> 	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:839)
> 	at java.util.HashMap$EntryIterator.next(HashMap.java:880)
> 	at java.util.HashMap$EntryIterator.next(HashMap.java:878)
> 	at org.apache.http.pool.AbstractConnPool.purgePoolMap(AbstractConnPool.java:469)
> 	at org.apache.http.pool.AbstractConnPool.closeExpired(AbstractConnPool.java:517)
> 	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.closeExpiredConnections(PoolingHttpClientConnectionManager.java:363)
> 	at com.jyvee.shared.http.HttpHelper.getHttpClient(HttpHelper.java:121)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message