You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Johannes Koch <jo...@fit.fraunhofer.de> on 2007/12/05 12:57:43 UTC

SocketTimeoutExeption in ElementalHttpServer

When running the org.apache.http.examples.ElementalHttpServer with Java 
1.4.2_16, I get the following SocketTimeoutException when requesting a 
resource with my browser:

I/O error: Read timed out
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at 
org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
	at 
org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
	at 
org.apache.http.impl.io.HttpRequestParser.parseHead(HttpRequestParser.java:71)
	at 
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
	at 
org.apache.http.impl.AbstractHttpServerConnection.receiveRequestHeader(AbstractHttpServerConnection.java:141)
	at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:135)
	at 
org.apache.http.examples.ElementalHttpServer$WorkerThread.run(ElementalHttpServer.java:250)


In the code only added

     ex.printStackTrace();

to the catch block in WorkerThread.run():

catch (IOException ex) {
     System.err.println("I/O error: " + ex.getMessage());
}
-- 
Johannes Koch
BIKA Web Compliance Center - Fraunhofer FIT
Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
Phone: +49-2241-142628    Fax: +49-2241-142065

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


Re: SocketTimeoutExeption in ElementalHttpServer

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2007-12-05 at 23:18 +0100, Johannes Koch wrote:
> Hi Oleg
> 
...
> > Johannes,
> > 
> > I think this is perfectly normal. The ElementalHttpServer shuts down
> > connections after 5 seconds of inactivity. Why do you see this as a
> > problem?
> 
> It's not a problem. I just thought it to be unusual that a normal thing 
> results in an exception.
> 

Johannes,

Blocking I/O uses exceptions to signal timeout conditions. This is
perfectly okay.

Oleg 


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


Re: SocketTimeoutExeption in ElementalHttpServer

Posted by Johannes Koch <jo...@fit.fraunhofer.de>.
Hi Oleg

Oleg Kalnichevski schrieb:
> On Wed, 2007-12-05 at 12:57 +0100, Johannes Koch wrote:
>> When running the org.apache.http.examples.ElementalHttpServer with Java 
>> 1.4.2_16, I get the following SocketTimeoutException when requesting a 
>> resource with my browser:
>>
>> I/O error: Read timed out
>> java.net.SocketTimeoutException: Read timed out
>> 	at java.net.SocketInputStream.socketRead0(Native Method)
>> 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
>> 	at 
>> org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
>> 	at 
>> org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
>> 	at 
>> org.apache.http.impl.io.HttpRequestParser.parseHead(HttpRequestParser.java:71)
>> 	at 
>> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
>> 	at 
>> org.apache.http.impl.AbstractHttpServerConnection.receiveRequestHeader(AbstractHttpServerConnection.java:141)
>> 	at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:135)
>> 	at 
>> org.apache.http.examples.ElementalHttpServer$WorkerThread.run(ElementalHttpServer.java:250)
>>
>>
>> In the code only added
>>
>>      ex.printStackTrace();
>>
>> to the catch block in WorkerThread.run():
>>
>> catch (IOException ex) {
>>      System.err.println("I/O error: " + ex.getMessage());
>> }
> 
> Johannes,
> 
> I think this is perfectly normal. The ElementalHttpServer shuts down
> connections after 5 seconds of inactivity. Why do you see this as a
> problem?

It's not a problem. I just thought it to be unusual that a normal thing 
results in an exception.

-- 
Johannes Koch
BIKA Web Compliance Center - Fraunhofer FIT
Schloss Birlinghoven, D-53757 Sankt Augustin, Germany
Phone: +49-2241-142628    Fax: +49-2241-142065

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


Re: SocketTimeoutExeption in ElementalHttpServer

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2007-12-05 at 12:57 +0100, Johannes Koch wrote:
> When running the org.apache.http.examples.ElementalHttpServer with Java 
> 1.4.2_16, I get the following SocketTimeoutException when requesting a 
> resource with my browser:
> 
> I/O error: Read timed out
> java.net.SocketTimeoutException: Read timed out
> 	at java.net.SocketInputStream.socketRead0(Native Method)
> 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
> 	at 
> org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
> 	at 
> org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
> 	at 
> org.apache.http.impl.io.HttpRequestParser.parseHead(HttpRequestParser.java:71)
> 	at 
> org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
> 	at 
> org.apache.http.impl.AbstractHttpServerConnection.receiveRequestHeader(AbstractHttpServerConnection.java:141)
> 	at org.apache.http.protocol.HttpService.handleRequest(HttpService.java:135)
> 	at 
> org.apache.http.examples.ElementalHttpServer$WorkerThread.run(ElementalHttpServer.java:250)
> 
> 
> In the code only added
> 
>      ex.printStackTrace();
> 
> to the catch block in WorkerThread.run():
> 
> catch (IOException ex) {
>      System.err.println("I/O error: " + ex.getMessage());
> }

Johannes,

I think this is perfectly normal. The ElementalHttpServer shuts down
connections after 5 seconds of inactivity. Why do you see this as a
problem?

Oleg


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