You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2004/01/14 19:47:29 UTC
DO NOT REPLY [Bug 26139] New: -
Memory leak in MultiThreadedHttpClient caused by bad .equals()
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26139>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26139
Memory leak in MultiThreadedHttpClient caused by bad .equals()
Summary: Memory leak in MultiThreadedHttpClient caused by bad
.equals()
Product: Commons
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: HttpClient
AssignedTo: commons-httpclient-dev@jakarta.apache.org
ReportedBy: jkinkead@marchex.com
Note: I have '2.0 release candidate 1'; I'm not sure which version this
translates into. The bug is definitely present in the current source.
MultiThreadedHttpClient uses the following code:
// Look for a list of connections for the given config
HostConnectionPool listConnections = (HostConnectionPool)
mapHosts.get(hostConfiguration);
if (listConnections == null) {
// First time for this config
listConnections = new HostConnectionPool();
listConnections.hostConfiguration = hostConfiguration;
mapHosts.put(hostConfiguration, listConnections);
}
The hash map relys on HostConfiguration's .equals() to resolve equality &
determine if there is a mapping for the configuration.
HostConfiguration has the following in it's .equals() method:
if (!protocol.equals(config.getProtocol())) {
return false;
}
. . . and Protocol has:
if (obj instanceof Protocol) {
Protocol p = (Protocol) obj;
return (
defaultPort == p.getDefaultPort()
&& scheme.equalsIgnoreCase(p.getScheme())
&& secure == p.isSecure()
&& socketFactory.equals(p.getSocketFactory()));
}
However, there is no .equals() method in any of the ProtocolSocketFactory
objects, and there isn't any note in the interface about the necessity of the
.equals() method.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org