Hi Oleg,

I am not sure about why you stated that the socket timeout is not reliable 
prior to Java 1.4. Are you talking w.r.t HttpClient or core Java. I am asking 
because, in my lab tests where I was simulating around 400 different Hardwares 
sending data to a file server. The server-client(s) pair was tested under 
different conditions. 

I could very well see that every time, I killed one of my spawned clients, the 
connect timeout on Server (implemented in java 1.3.x) was right on target.


Raj

-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 16, 2006 9:06 AM
To: HttpClient User Discussion
Subject: Re: Connection either times out or hangs using https


On Thu, 2006-02-16 at 14:42 +0100, [EMAIL PROTECTED] wrote:
> Hi,
> 
> I inherited the maintanance of a program
> that utilizes HttpClient 2.0.x class for https call
> on a linux box running in a 1.3.x JVM.
> 
> This program is called thousands of times a day.
> Ocassionally (once a month) this program fails with a
> ConnectionTimeoutException even though there are
> generous timeouts set. Subsequent executions
> of this program will then fail for the same reason.
> At present we reboot the box to overcome this failure.
> 
> 
> The following i already tried with no success:
> 
> Migrate to 1.4.x JVM decomissioning the external JSSE libs.
> Migrate to HttpClient 3.0.x. However if I do this the program
> hangs trying to open the connection even though both socket
> and conection timeout is set.
> 
> 
> The following i tried with success:
> 
> Run the program in 1.5.x JVM. This does fine regardless on what
> my build is based. This now totally confuses me. What is the difference
> to the 1.4.x JVM ?
> 
> 
> Any hint is aprecitated,

Gerrit,

To my knowledge Sun's implementation of JSSE in 1.5 has been completely
rewritten to order to enable NIO (non-blocking I/O) support for secure
sockets. It is not surprising at all that one may get totally different
results when using SSL with Sun JRE 1.4 and 1.5.

Firstly, there is no reliable way to enforce the socket connection
timeout in Java prior to Java 1.4, so seriously consider upgrading to
Java 1.4 or 1.5. HttpClient 2.0 employs some really nasty hack to
simulate the connect timeout which it is not 100% reliable and requires
a controller thread to be spawned on each connection attempt. HttpClient
3.0 makes use of reflection to invoke Java 1.4 specific socket methods
when available.

Secondly, consider implementing a custom socket factory which directly
uses 1.4 specific methods when opening sockets. This socket factory can
be used as an example

http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/httpclient/trunk/src/contrib/org/apache/commons/httpclient/contrib/ssl/AuthSSLProtocolSocketFactory.java?view=markup
  

Thirdly, consider upgrading to HttpClient 3.0. HttpClient 2.0 is no
longer supported.

Hope this helps

Oleg

> thank you,
> Gerrit 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]


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

Reply via email to