You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Eric Bloch <bl...@laszlosystems.com> on 2004/03/17 01:31:42 UTC

2.0 rc1 leaking sockets?

Hi there,

I've got a question.  I'm using the Multithreaded Connection Manager and 
I know that I'm always calling releaseConnection() on every connection I 
use.  Are there any reports (or possibilities) that releaseConnection() 
will fail to close an open socket or lose track of is such that I will 
see socket leaks?   This is running against JRE 1.3.1 (on linux).

I have a custy that is seeing leaks WebSphere and at the moment, 
httpclient is the current suspect since it's one of the few things in 
the app that causes it to open sockets.

Thanks,
-Eric


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


Re: 2.0 rc1 leaking sockets?

Posted by Michael Becke <be...@u.washington.edu>.
Then the maxHOSTConnections would essentially be ignored.  The total 
number of connections will not exceed the maxTOTALConnections.

Mike

Eric Bloch wrote:
> 
> 
> Michael Becke wrote:
> 
>> Hi Eric,
>>
>> By default 20 is max number of total connections.  This number will 
>> not  be exceeded regardless of the number of hosts being connected to.
> 
> 
> What if maxconnsperhost is > maxtotal ?  For example, imagine I'm 
> setting maxconnsperhost to 1000.
> 
> Thanks,
> Eric
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
> 

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


Re: 2.0 rc1 leaking sockets?

Posted by Eric Bloch <bl...@laszlosystems.com>.

Michael Becke wrote:

> Hi Eric,
>
> By default 20 is max number of total connections.  This number will 
> not  be exceeded regardless of the number of hosts being connected to.

What if maxconnsperhost is > maxtotal ?  For example, imagine I'm 
setting maxconnsperhost to 1000.

Thanks,
Eric




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


Re: 2.0 rc1 leaking sockets?

Posted by Michael Becke <be...@u.washington.edu>.
Hi Eric,

By default 20 is max number of total connections.  This number will not  
be exceeded regardless of the number of hosts being connected to.

There may have been a few API changes between RC1 and 2.0, but they  
should be pretty minor.  Please have a look at the release notes  
<http://www.apache.org/dist/jakarta/commons/httpclient/RELEASE- 
NOTES.txt> for what has changed between each release.  For more  
specifics you can compare the releases using CVS.  RC1 is tagged as  
HTTPCLIENT_2_0_RC1 and 2.0 is flagged as HTTPCLIENT_2_0_FINAL.

Mike

On Mar 17, 2004, at 11:36 PM, Eric Bloch wrote:

> Hey Michael,
>
> Thanks .. I am using setMaxConnectionsPerHost()... and not  
> setMaxTotalConnections().  Assuming there is a fixed number of hosts,  
> will there be a fixed number of sockets used ?
>
> Also were there any API or behavioral changes (besides bug fixes :-))  
> between 2.0 rc1 and final that I should be aware of?  Or is there a  
> doc somewhere that has the list of changes between rc1 and final?
> Thanks again!
>
> -Eric
>
>
> Michael Becke wrote:
>
>> On Mar 17, 2004, at 5:05 PM, Eric Bloch wrote:
>>
>>> Thanks... just to be clear though... the multi-threadded connection  
>>> mgr should never hold open more than a fixed number of sockets  
>>> though, right?
>>
>>
>> Yes, any one instance of MultiThreadedHttpConnectionManager will only  
>> have a certain number of open connections.  This is configurable via  
>> setMaxTotalConnections().  You will need to ensure that you are  
>> reusing the same instance of the connection manager.
>>
>> There were also a number of bugs fixed in the  
>> MultiThreadedHttpConnectionManager between 2.0 RC1 and the final 2.0  
>> relase.  I would suggest upgrading to 2.0 just to be sure.
>>
>> Mike
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:  
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:  
>> commons-httpclient-dev-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:  
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:  
> commons-httpclient-dev-help@jakarta.apache.org
>


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


Re: 2.0 rc1 leaking sockets?

Posted by Eric Bloch <bl...@laszlosystems.com>.
Hey Michael,

Thanks .. I am using setMaxConnectionsPerHost()... and not 
setMaxTotalConnections().  Assuming there is a fixed number of hosts, 
will there be a fixed number of sockets used ?

Also were there any API or behavioral changes (besides bug fixes :-)) 
between 2.0 rc1 and final that I should be aware of?  Or is there a doc 
somewhere that has the list of changes between rc1 and final? 
 

Thanks again!

-Eric


Michael Becke wrote:

> On Mar 17, 2004, at 5:05 PM, Eric Bloch wrote:
>
>> Thanks... just to be clear though... the multi-threadded connection 
>> mgr should never hold open more than a fixed number of sockets 
>> though, right?
>
>
> Yes, any one instance of MultiThreadedHttpConnectionManager will only 
> have a certain number of open connections.  This is configurable via 
> setMaxTotalConnections().  You will need to ensure that you are 
> reusing the same instance of the connection manager.
>
> There were also a number of bugs fixed in the 
> MultiThreadedHttpConnectionManager between 2.0 RC1 and the final 2.0 
> relase.  I would suggest upgrading to 2.0 just to be sure.
>
> Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org


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


Re: 2.0 rc1 leaking sockets?

Posted by Michael Becke <be...@u.washington.edu>.
On Mar 17, 2004, at 5:05 PM, Eric Bloch wrote:

> Thanks... just to be clear though... the multi-threadded connection 
> mgr should never hold open more than a fixed number of sockets though, 
> right?

Yes, any one instance of MultiThreadedHttpConnectionManager will only 
have a certain number of open connections.  This is configurable via 
setMaxTotalConnections().  You will need to ensure that you are reusing 
the same instance of the connection manager.

There were also a number of bugs fixed in the 
MultiThreadedHttpConnectionManager between 2.0 RC1 and the final 2.0 
relase.  I would suggest upgrading to 2.0 just to be sure.

Mike


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


Re: 2.0 rc1 leaking sockets?

Posted by Eric Bloch <bl...@laszlosystems.com>.
Thanks... just to be clear though... the multi-threadded connection mgr 
should never hold open more than a fixed number of sockets though, right?

I've got a case where there's a clear socket leak in the java process 
and someone is pointing at me right now (and I use httpclient and always 
release my connections).

-Eric


Michael Becke wrote:

> Hi Eric,
>
> The multi-threaded connection manager holds on to connections that 
> have been released, but it does not necessarily close them.  
> Connections are only closed if the server sends a "connection: close" 
> header or if HTTP 1.0 is used.
>
> There are currently two open bugs that may apply to your situation:
>
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=25372>
>   and
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=27589>
>
> I would also suggest checking the archive for more discussion on this 
> matter.
>
> Mike
>
> On Mar 16, 2004, at 7:31 PM, Eric Bloch wrote:
>
>> Hi there,
>>
>> I've got a question.  I'm using the Multithreaded Connection Manager 
>> and I know that I'm always calling releaseConnection() on every 
>> connection I use.  Are there any reports (or possibilities) that 
>> releaseConnection() will fail to close an open socket or lose track 
>> of is such that I will see socket leaks?   This is running against 
>> JRE 1.3.1 (on linux).
>>
>> I have a custy that is seeing leaks WebSphere and at the moment, 
>> httpclient is the current suspect since it's one of the few things in 
>> the app that causes it to open sockets.
>>
>> Thanks,
>> -Eric
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: 
>> commons-httpclient-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org


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


Re: 2.0 rc1 leaking sockets?

Posted by Michael Becke <be...@u.washington.edu>.
Hi Eric,

The multi-threaded connection manager holds on to connections that have 
been released, but it does not necessarily close them.  Connections are 
only closed if the server sends a "connection: close" header or if HTTP 
1.0 is used.

There are currently two open bugs that may apply to your situation:

<http://issues.apache.org/bugzilla/show_bug.cgi?id=25372>
   and
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27589>

I would also suggest checking the archive for more discussion on this 
matter.

Mike

On Mar 16, 2004, at 7:31 PM, Eric Bloch wrote:

> Hi there,
>
> I've got a question.  I'm using the Multithreaded Connection Manager 
> and I know that I'm always calling releaseConnection() on every 
> connection I use.  Are there any reports (or possibilities) that 
> releaseConnection() will fail to close an open socket or lose track of 
> is such that I will see socket leaks?   This is running against JRE 
> 1.3.1 (on linux).
>
> I have a custy that is seeing leaks WebSphere and at the moment, 
> httpclient is the current suspect since it's one of the few things in 
> the app that causes it to open sockets.
>
> Thanks,
> -Eric
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>


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