hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Gonsalves <JGonsal...@Xtensible.com>
Subject Re: Multiple httpclient sessions and hanging??
Date Wed, 11 Jun 2003 19:44:45 GMT

Ipersonally don't think it's HTTPClient, however, the running out of 
sockets idea is interesting.  I recently hung reading a file with the 
following last four lines of the stack trace being:
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
- locked (a java.io.BufferedInputStream)

Both applications are single threaded, and I haven't done anything with 
MultiThreadedHttpConnectionManager.  All I did to "go to Beta 1" was 
chang out the Jar File.

I also do not close the connection after each request, I close it after 
each update, which can be a series of request.  I'm assuming each time I 
close the connection I'd have to "log back in" to the website, IE where 
the files are kept.  There login page simple consists of a POST command 
with a username and password stuck inside, for all to see...  Is it your 
recomendation that after each request I close the connection instead of 
recycle?  Since I only open the connection once per update, unless I run 
into socket timeouts and other catched exceptions in which I first run 
close connection then reopen the connection, I believe my single close 
at the end is sufficient. 

I get no exceptions, without a kill -3, it looks as though it's running 
fine and poof, hung.  How can I check my System Socket Usage, is there 
some safeguards I can put in to not open unless available?
Thanks for your help!


Michael Becke wrote:

> Hi Jan,
> It is difficult to be sure without a little more detail.  At this 
> point my only guess is that you are running out of sockets (on either 
> the client or server) and/or HttpConnections.  It is good that you are 
> using Beta1.  Alpha3 had some serious problems, particularly with 
> posts and threading.  Here are a few things that will help to narrow 
> this problem down:
>  - are you using the MultiThreadedHttpConnectionManager?
>    - if so, are you using a connectionFactory timeout? see 
> HttpClient.setHttpConnectionFactoryTimeout()
>    - if not, how are you managing connection resources?  Are you sure 
> that connections are being closed?
>  - are any exceptions being printed?
>  - are you calling HttpMethod.releaseConnection() after each execution?
>  - also, try setting SO_TIMEOUT to something reasonable using either 
> HttpClient.setTimeout() or HttpConnection.setSoTimeout().  If the 
> execution of a method is stalling in the middle of a read this will 
> force an exception.
> Mike
> Jan Gonsalves wrote:
>> I'm seeing a problem where I have two very similar HttpClient apps 
>> running in different JVMs.  I ran App1 with Beta1 for 20+ ours 
>> straight and it just chugged along and did it's thing.  I started 
>> App2 with Alpha3 this morning and the minute it came up, App1 hung.  
>> Definition of Hung: "In the middle of downloading information, often 
>> from a file on a foriegn FTP server using a ZipInputStream, program 
>> never returns from reading stream. How ever, sometimes it has "hung" 
>> when doing a ExecuteMethod cal."  We have seen cases where App1 has 
>> been hanging and we were hoping it was some timeout or something that 
>> had been fixed in Beta 1.  I changed the second app to use BEta1 and 
>> ran them together for a 5+ hours and just recently noticed App1 hung 
>> again.  It only seems to happen when App2 is running on the same 
>> machine, I never ran into this while in development because App2 was 
>> developed on a separate machine.
>> The thing that kills me is App2 never has this issue.  Some 
>> application notes:
>> Incremental Updates - Both Apps run for a couple minutes and then 
>> sleep for 10.  While sleeping no connections are kept open.
>> App1 reads zip files on a FTP server, App2 reads input streams from 
>> the response body
>> App1 performs signifigantly less POST/GET calls than App2.  App1 
>> requests information to be created and then put on the FTP server, 
>> Files are read from there and not downloaded(Most, not all hangs 
>> happen here), App2 requests information and it's sent via the 
>> response body.
>> I know this is vague, I'm just wondering if anyone knows of problems 
>> running multiple HttpClient Apps.  I'm going to run with the log on 
>> from now on, but it can take so long for the problem to occur it 
>> fills up disk space pretty rapidly.
>> Any ideas would be greatly appreciated.
>> Jan Gonsalves
>> ---------------------------------------------------------------------
>> 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

View raw message