After doing some tests using HttpClient source code, I have found that Socket#getReceiveBufferSize() method returned a zero value. This is a random behaviour because it usually returns 8192 bytes. When zero is returned, the exception is thrown and HttpClient fails.
I have trying to isolate different parts and I have found that under some circumstances, Socket#getReceiveBufferSize() returns 0. I have developed a very simple multi-threading application that starts threads and waits until they die. Each thread open a Socket to a WebServer and invokes Socket#getReceiveBufferSize(). Sometimes, this method returns 0 for some sockets. I have tried with different JVM versions under Windows XP-Service Pack 2: a) java version "1.3.1_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_03-b03) Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed mode) b) java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode) So, it doesn't seem like a JVM bug. It seems like a Windows bug/"feature". What solution do you recommend me to patch HttpConnection? Kind regards, Jorge. -----Original Message----- From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Sent: mi�rcoles, 09 de marzo de 2005 22:06 To: HttpClient Project Subject: RE: Error with multiple connections Jorge, Judging by the exception stack there can be only one possible explanation for this exception that for some reason the Socket#getReceiveBufferSize() method returned a non-positive value, which as far as I can tell *should* never happen: http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/httpclient/HttpConnection.html#690 This does seem like a JVM bug to me. What JVM are you using? Oleg On Wed, 2005-03-09 at 09:58 +0100, Jorge Gonzalez Varela wrote: > Hello, > > I am using HttpClient version 2.0.2 > > Thanks, > Jorge. > > > -----Original Message----- > From: Ortwin Gl�ck [mailto:[EMAIL PROTECTED] > Sent: martes, 08 de marzo de 2005 20:26 > To: HttpClient Project > Subject: Re: Error with multiple connections > > Jorge, > > which version of HttpClient are you using? > > Kind regards > > Ortwin Gl�ck > > Jorge Gonzalez Varela wrote: > > Hello, > > > > > > > > I am having some problems while trying multiple connections over a > > HttpClient object with a MultiThreadedHttpConnectionManager. I am > > launching 10 threads and each thread executes some GetMethods using this > > HttpClient object. > > > > > > > > Some times I got an error like this: > > > > > > > > java.lang.IllegalArgumentException: Buffer size <= 0 > > > > at java.io.BufferedInputStream.<init>(Unknown Source) > > > > at > > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:70 > > 3) > > > > at > > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon > > nectionAdapter.open(MultiThreadedHttpConnectionManager.java:1170) > > > > at > > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6 > > 28) > > > > at > > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:4 > > 97) > > > > at Main$Hilo.run(Main.java:58) > > > > > > > > Does anybody have any idea? > > > > > > > > Thanks in advance, > > > > Jorge > > > > > > > > > > -------------------------------------------------------------------------------------- > > This message and any files transmitted with it are confidential and > > intended solely > > for the use of the individual or entity to whom they are addressed. No > > confidentiality > > or privilege is waived or lost by any wrong transmission. > > If you have received this message in error, please immediately destroy it > > and kindly > > notify the sender by reply email. > > You must not, directly or indirectly, use, disclose, distribute, print, or > > copy any > > part of this message if you are not the intended recipient. Opinions, > > conclusions and > > other information in this message that do not relate to the official > > business of > > Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given > > nor endorsed by it. > > -------------------------------------------------------------------------------------- > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------------------------------------- This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. No confidentiality or privilege is waived or lost by any wrong transmission. If you have received this message in error, please immediately destroy it and kindly notify the sender by reply email. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Opinions, conclusions and other information in this message that do not relate to the official business of Ydilo Advanced Voice Solutions, S.A. shall be understood as neither given nor endorsed by it. -------------------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
