Re: Memory Leaks when web server hangs

2004-02-02 Thread Srinivas Vemula
Oleg,
  
   We are using JDK1.4.1 and connection time out is set to 30Ms and 
read time out to 60Ms. We are trying to connect to a IP Camera, and send 
a heart beat command to the camera to check for its availability every 
30 Secs from the time we find it is un available. If the web server is 
down, we feel that HttpClient is not cleaning up failed connections 
properly and thats resulting in Memory Leaks at the server side.

   The code we use is the standard way of using HttpClient and all the 
code is in a method and new HttpClient object is created for every 
request. Are there any ways to make sure the connections are all being 
purged properly? Are there any precautionary measures or flags we can 
set on HttpClient API when communicating with a web server (running on 
firm ware) with relatively less RAM and processing power (IpCamera with 
built in web server)?

Thanks for your time and help.
Srini
Kalnichevski, Oleg wrote:

Mike and Oleg, the stack trace Srini included indicates that HttpClient is
attempting to create a new timeout thread on every connection - does this
always occur or is it just one timeout thread per httpclient instance?  It
would be ideal if we could reduce this to one static thread as starting
threads is never nice for server side apps.  Not sure how feasible that is
though.
   

Hi Srini,
HttpClient uses an additional controller thread to work around the limitation of older 
( 1.4) JDKs which do not provide a possibility to set connect timeout. If you do not 
really need to control connect timeout (for instance, when communicating with an intranet 
site with good availability) simply set connect timeout to. That will prevent HttpClient 
from spawning an additional thread per request.
Adrian, et al
Another possibility to use reflection to set connect timeout using the Socket methods 
when running in JVM 1.4 or above
Oleg



-Original Message-
From: Adrian Sutton [mailto:[EMAIL PROTECTED]
Sent: Monday, February 02, 2004 09:03
To: Commons HttpClient Project
Subject: Re: Memory Leaks when web server hangs
On 2/2/04 2:00 PM, Srinivas Vemula [EMAIL PROTECTED] wrote:

 

Hi All,
 We are seeing thread leaks when having client open connections to a web
server that hangs. Has any one seen this happening?? How do we ensure that the
library correctly closes  socket connections on failures, cleaning up system
resources, and  threads actually finish in  the timeout period and get freed
up. Would using MultiThreadedHttpConnectionManager
file:///D:/silkroad/http-commons/commons-httpclient-2.0-rc3/docs/threading.ht
ml#MultiThreadedHttpConnectionManager   be of any help??
   

Hi Srini,
If you're using the same HttpClient instance across multiple threads, you
must use the MultiThreadedHttpConnectionManager or you'll run into strange
problems.  If you're using separate HttpClient instances, you may as well
stick with the single threaded (default) connection manager.
In terms of connections hanging - you probably want to look into the
setConnectionTimeout and setTimeout methods of the HttpClient class.  These
allow you to control how long HttpClient waits when making a connection and
how long it waits for data once the connection is established.  If you have
set either of these to 0 (not sure what the default is, it may be platform
specific) the connection will never timeout which sounds a lot like what
you're seeing.
Mike and Oleg, the stack trace Srini included indicates that HttpClient is
attempting to create a new timeout thread on every connection - does this
always occur or is it just one timeout thread per httpclient instance?  It
would be ideal if we could reduce this to one static thread as starting
threads is never nice for server side apps.  Not sure how feasible that is
though.
 

Srini
   

Regards,

Adrian Sutton.

--
Intencha tomorrow's technology today
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD
www.intencha.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

--
Srinivas Vemula  +91 40 23547826- Ext 201
Associate Consultant +91 40 23541447 (Fax)
Mensamind+91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for the named 
recipient(s) only. If you are not an intended recipient of this email you must not 
copy, distribute or take any further action in reliance on it. You should delete it 
and notify the sender immediately.



Re: Next Release?

2004-01-08 Thread Srinivas Vemula
Hi All,
   I completely understand. Only reason I was curious was cos the 
web-site mentions all the big stuff planned for 2.1. Thank you all for 
your efforts.
srini

Kalnichevski, Oleg wrote:

Srinivas,
Making predictions about release dates for open-source projects is a nasty business. 
The final 2.0 release was initially anticipated in June-July 2003. It did not quite 
work out for us. Even though 2.0 is _almost_ finished (we have not been seeing any 
major bugs since September 2003 I believe) it may still take a month or two to get 
everything finalized. There's one thing I am pretty confident about is that we will 
get 2.0rc3 out sometime this month. If no significant problems are reported for two 
weeks or so past 2.0rc3, it will be declared THE 2.0 release.
As to the development branch (currently dubbed 2.1) I would love to see the first public Alpha ready by March.

Oleg

-Original Message-
From: Srinivas Vemula [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 10:57
To: Commons HttpClient Project
Subject: Next Release?
Hi,
   When are u planning to make the next release??
srini
 

--
Srinivas Vemula  +91 40 23547826- Ext 201
Associate Consultant +91 40 23541447 (Fax)
Mensamind+91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for the named 
recipient(s) only. If you are not an intended recipient of this email you must not 
copy, distribute or take any further action in reliance on it. You should delete it 
and notify the sender immediately.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reading Chunked Stream using HttpClient

2003-12-11 Thread Srinivas Vemula
Hi,
  
   We have a an application which sends chunked input stream for a URL 
request. We are using HttpClient to get the response. The chunked 
response sent by the application is actually a motion image. The motion 
image is retrieved by the first GET command operation and will be send 
as the sequential data. Therefore, display application should display 
the sequential data with dividing the data into an image-unit. In this 
case, boundary character string --myboundary is fixed as an index.

   What is the best way of handling this type of response and storing 
each image data in  a byte[] array , and using a new byte[] array when 
we see --myboundary in the stream.

   The URL looks like
   http://172.16.101.113/image?speed=20
   and the response headers are
   Content-Type: image/jpeg
Thank you all in advance
srini
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Reading Chunked Stream using HttpClient

2003-12-11 Thread Srinivas Vemula
Odi,
   Yes, you are right.
   If we access the URL from broweser, it opens up a file dialog 
box and starts filling in bytes and there is no end to it unless we 
close the window. We are able to read the stream with 
get.getResponseBodyAsStream(). The stream is image bytes delimited by an 
ascii string --myboundary, So I guess i just need figure out an easy 
way of  cutting this stream into bytes for every occurence of that 
string.  That sounds more of an IO issue. Any ideas?
Thanks for your time and response.

Srini
  

Ortwin Glück wrote:

Srinivas,

I understand that you do not mean HTTP's chunked transfer encoding by 
the term chunked stream and chunked input. I guess you are using a 
Multipart-MIME like content encoding. HttpClient does NOT however deal 
with the content and does not provide any means to parse the contents 
format. You must therefore either parse the response stream by 
yourself or use an existing Multipart-MIME library to decode the 
multipart stream. You may want to have a look at the Commons 
FileUpload code which does exactly that or at Multipart-MIME Email 
handling code which must do a similar thing.

Regards

Odi

Srinivas Vemula wrote:

Hi,
 We have a an application which sends chunked input stream for a 
URL request. We are using HttpClient to get the response. The chunked 
response sent by the application is actually a motion image. The 
motion image is retrieved by the first GET command operation and will 
be send as the sequential data. Therefore, display application should 
display the sequential data with dividing the data into an 
image-unit. In this case, boundary character string --myboundary is 
fixed as an index.

   What is the best way of handling this type of response and storing 
each image data in  a byte[] array , and using a new byte[] array 
when we see --myboundary in the stream.

   The URL looks like
   http://172.16.101.113/image?speed=20
   and the response headers are
   Content-Type: image/jpeg
Thank you all in advance
srini
 

-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]


--
Srinivas Vemula  +91 40 23547826- Ext 201
Associate Consultant +91 40 23541447 (Fax)
Mensamind+91 98497-42720 (Mobile)
Hyderabad
India
http://www.mensamind.com

DISCLAIMER
The information contained in this e-mail is confidential and intended for the named 
recipient(s) only. If you are not an intended recipient of this email you must not 
copy, distribute or take any further action in reliance on it. You should delete it 
and notify the sender immediately.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]