FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b101)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b101, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Assertion
protected synchronized void putInKeepAliveCache() {
if (inCache) {
assert false : "Duplicate put to keep alive cache";
return;
}
in sun.net.www.http.HttpClient is being triggered.
Cause is that code in HttpClient::new
if ((ret.proxy != null && ret.proxy.equals(p)) ||
(ret.proxy == null && p == null)) {
synchronized (ret) {
ret.cachedHttpClient = true;
assert ret.inCache;
ret.inCache = false;
}
}
when entry is extracted from cache is not causing "inCache" to be set to false as (for whatever reason) the supplied Proxy is (for example DIRECT) whereas the ret.proxy is "HTTP".
I've never really understood why you fallback to DIRECT when, for example, a defined HTTP proxy is unreachable, but its got to be something to do with this behaviour.
Anyway, the end result is that keep-alive connections are not kept alive as the connection extracted from the cache with inCache still set to TRUE is not returned to the cache when finished with
REPRODUCIBILITY :
This bug can be reproduced always.