hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: HttpClient 3.1 / JavaHttp TIME_WAIT differences
Date Thu, 06 Dec 2007 15:11:19 GMT
On 06/12/2007, sebb <sebbaz@gmail.com> wrote:
> On 06/12/2007, Roland Weber <ossfwot@dubioso.net> wrote:
> > Hi Sebastian,
> >
> > > If HttpClient (or my app) is failing to close sockets at the end,
> > > perhaps it needs to be enhanced - otherwise it will be causing the
> > > server to go into TIME_WAIT instead?
> >
> > I'm not sure whether the server needs to go into TIME_WAIT
> > if it gets a reset packet. But it can't hurt to call
> > SimpleHttpConnectionManager.shutdown() when exiting
> > the application.
>
> Oops I forgot:
> JMeter 2.3.1 calls closeIdleConnections(-1000) in the threadFinished() code.
>
> The latest (unreleased) code calls shutdown() instead.
>
> I'll add that to the test application and see if it helps.

That seems to have solved it:

With the added shutdown() call in the test app, HttpClient now behaves
the same as Java, i.e. the connections to google.com and .co.uk are
both left in TIME_WAIT state if keep-alive is selected, but not if
keep-alive is not.

So your analysis was spot on.

Thanks for all the replies.

> > Looks like we forgot to add that method
> > to the interface, but it's too late for 3.1 now.
>
> I noticed that. Perhaps worth a Jira in case a bugfix release is needed?
>
> > I wouldn't want to mess with shutdown hooks [1] by default,
> > but I will remember the problem when we start working on
> > an HttpClient 4.0 Tutorial.
>
> Maybe add a shutdown method to the HttpClient API?
> [Perhaps that exists anyway]
>
> In 3.1, one has to get the conn manager and check if it is one of the
> mgrs that supports shutdown.
>
> > cheers,
> >  Roland
> >
> > [1]
> > http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
>

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


Mime
View raw message