You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Preygel, Sofya" <Pr...@pbworld.com> on 2004/05/12 19:25:42 UTC

'Socket closed' exception using

Hello,

We are trying to use HTTPClient.execute(PostMethod) for sending SOAP
requests to Connotate's Web Mining Server (WMS). The requests are sent
every 1 minute, and in most cases everything works fine. However, every
so often (sometimes way too often!) we are getting the 'Socket closed'
exception. The socket timeout was initially set to 10 seconds (10000
millis), but even after I set it to 120 seconds (120000 millis), we are
still seeing it happening quite often. I tried to use both the
getResponseBodyAsString() and getResponseBodyAsStream() to retrieve the
response, but it does not change anything.

The application is running on Windows 2000 (SP4). I tried both the
HTTPClient v2.0 (final) and the latest night build (as of yesterday),
but the results are the same. We are using HTTP 1.0
(PostMethod.setHttp11(false)), with the application running on the same
computer as the WMS.

I will appreciate any suggestions about what can be done here.

Thank you,
Sofya

Stack trace:
08:54:37 DEBUG [Thread-19] - enter PostMethod.renerateRequestBody()
08:54:37 DEBUG [Thread-19] - enter
EntityEnclosingMethod.renerateRequestBody()
08:54:37 DEBUG [Thread-19] - enter getContentCharSet( Header
contentheader )
08:54:37 DEBUG [Thread-19] - enter HeaderElement.parse(String)
08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
int)
08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
int)
08:54:37 DEBUG [Thread-19] - Using buffered request body
08:54:37 DEBUG [Thread-19] - enter
HttpConnection.getRequestOutputStream()
08:54:37 DEBUG [Thread-19] - Request body sent
08:54:37 DEBUG [Thread-19] - enter
HttpConnection.flushRequestOutputStream()
08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
08:54:37 DEBUG [Thread-19] - enter
HttpConnection.closeSockedAndStreams()
08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
08:54:37 DEBUG [Thread-19] - enter
HttpConnection.closeSockedAndStreams()
08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
08:54:37 DEBUG [Thread-19] - enter
HttpConnection.closeSockedAndStreams()
08:54:37 DEBUG [Thread-19] - enter HttpConnection.releaseConnection()
08:54:37 ERROR [Thread-19] - I/O exception executing the get data
request 'Execute'. 
java.net.SocketException: Socket closed
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
	at
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
	at
org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(H
ttpConnection.java:1368)
	at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
	at
java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
	at
org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Ht
tpConnection.java:799)
	at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase
.java:2324)
	at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
se.java:2657)
	at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
:1093)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
75)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
29)
	at
pbf.travinfo.dcol.CHPDI.AgentLibrary.getSOAPResponse(AgentLibrary.java:6
48)

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


Re: 'Socket closed' exception using

Posted by Michael Becke <be...@u.washington.edu>.
Hi Sofya,

There are a couple of possibilities, but it sounds like you are 
experiencing some connection management issues.  If you could, please 
send some sample code showing how you are using HttpClient, as well as a 
wire log <http://jakarta.apache.org/commons/httpclient/logging.html> 
(just the headers please).

Mike

Preygel, Sofya wrote:

> Hello,
> 
> We are trying to use HTTPClient.execute(PostMethod) for sending SOAP
> requests to Connotate's Web Mining Server (WMS). The requests are sent
> every 1 minute, and in most cases everything works fine. However, every
> so often (sometimes way too often!) we are getting the 'Socket closed'
> exception. The socket timeout was initially set to 10 seconds (10000
> millis), but even after I set it to 120 seconds (120000 millis), we are
> still seeing it happening quite often. I tried to use both the
> getResponseBodyAsString() and getResponseBodyAsStream() to retrieve the
> response, but it does not change anything.
> 
> The application is running on Windows 2000 (SP4). I tried both the
> HTTPClient v2.0 (final) and the latest night build (as of yesterday),
> but the results are the same. We are using HTTP 1.0
> (PostMethod.setHttp11(false)), with the application running on the same
> computer as the WMS.
> 
> I will appreciate any suggestions about what can be done here.
> 
> Thank you,
> Sofya
> 
> Stack trace:
> 08:54:37 DEBUG [Thread-19] - enter PostMethod.renerateRequestBody()
> 08:54:37 DEBUG [Thread-19] - enter
> EntityEnclosingMethod.renerateRequestBody()
> 08:54:37 DEBUG [Thread-19] - enter getContentCharSet( Header
> contentheader )
> 08:54:37 DEBUG [Thread-19] - enter HeaderElement.parse(String)
> 08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
> int)
> 08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
> int)
> 08:54:37 DEBUG [Thread-19] - Using buffered request body
> 08:54:37 DEBUG [Thread-19] - enter
> HttpConnection.getRequestOutputStream()
> 08:54:37 DEBUG [Thread-19] - Request body sent
> 08:54:37 DEBUG [Thread-19] - enter
> HttpConnection.flushRequestOutputStream()
> 08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
> 08:54:37 DEBUG [Thread-19] - enter
> HttpConnection.closeSockedAndStreams()
> 08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
> 08:54:37 DEBUG [Thread-19] - enter
> HttpConnection.closeSockedAndStreams()
> 08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
> 08:54:37 DEBUG [Thread-19] - enter
> HttpConnection.closeSockedAndStreams()
> 08:54:37 DEBUG [Thread-19] - enter HttpConnection.releaseConnection()
> 08:54:37 ERROR [Thread-19] - I/O exception executing the get data
> request 'Execute'. 
> java.net.SocketException: Socket closed
> 	at java.net.SocketOutputStream.socketWrite0(Native Method)
> 	at
> java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
> 	at
> java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> 	at
> org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(H
> ttpConnection.java:1368)
> 	at
> java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
> 	at
> java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
> 	at
> org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Ht
> tpConnection.java:799)
> 	at
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase
> .java:2324)
> 	at
> org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
> se.java:2657)
> 	at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
> :1093)
> 	at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
> 75)
> 	at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
> 29)
> 	at
> pbf.travinfo.dcol.CHPDI.AgentLibrary.getSOAPResponse(AgentLibrary.java:6
> 48)
> 
> ---------------------------------------------------------------------
> 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


Re: 'Socket closed' exception using

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
How are you setting your headers?  That is sometimes the issue on socket 
closings.

At 10:25 AM 5/12/2004, Preygel, Sofya wrote:
>Hello,
>
>We are trying to use HTTPClient.execute(PostMethod) for sending SOAP
>requests to Connotate's Web Mining Server (WMS). The requests are sent
>every 1 minute, and in most cases everything works fine. However, every
>so often (sometimes way too often!) we are getting the 'Socket closed'
>exception. The socket timeout was initially set to 10 seconds (10000
>millis), but even after I set it to 120 seconds (120000 millis), we are
>still seeing it happening quite often. I tried to use both the
>getResponseBodyAsString() and getResponseBodyAsStream() to retrieve the
>response, but it does not change anything.
>
>The application is running on Windows 2000 (SP4). I tried both the
>HTTPClient v2.0 (final) and the latest night build (as of yesterday),
>but the results are the same. We are using HTTP 1.0
>(PostMethod.setHttp11(false)), with the application running on the same
>computer as the WMS.
>
>I will appreciate any suggestions about what can be done here.
>
>Thank you,
>Sofya
>
>Stack trace:
>08:54:37 DEBUG [Thread-19] - enter PostMethod.renerateRequestBody()
>08:54:37 DEBUG [Thread-19] - enter
>EntityEnclosingMethod.renerateRequestBody()
>08:54:37 DEBUG [Thread-19] - enter getContentCharSet( Header
>contentheader )
>08:54:37 DEBUG [Thread-19] - enter HeaderElement.parse(String)
>08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
>int)
>08:54:37 DEBUG [Thread-19] - enter HeaderElement.parsePair(char[], int,
>int)
>08:54:37 DEBUG [Thread-19] - Using buffered request body
>08:54:37 DEBUG [Thread-19] - enter
>HttpConnection.getRequestOutputStream()
>08:54:37 DEBUG [Thread-19] - Request body sent
>08:54:37 DEBUG [Thread-19] - enter
>HttpConnection.flushRequestOutputStream()
>08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
>08:54:37 DEBUG [Thread-19] - enter
>HttpConnection.closeSockedAndStreams()
>08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
>08:54:37 DEBUG [Thread-19] - enter
>HttpConnection.closeSockedAndStreams()
>08:54:37 DEBUG [Thread-19] - enter HttpConnection.close()
>08:54:37 DEBUG [Thread-19] - enter
>HttpConnection.closeSockedAndStreams()
>08:54:37 DEBUG [Thread-19] - enter HttpConnection.releaseConnection()
>08:54:37 ERROR [Thread-19] - I/O exception executing the get data
>request 'Execute'.
>java.net.SocketException: Socket closed
>         at java.net.SocketOutputStream.socketWrite0(Native Method)
>         at
>java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
>         at
>java.net.SocketOutputStream.write(SocketOutputStream.java:136)
>         at
>org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(H
>ttpConnection.java:1368)
>         at
>java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:69)
>         at
>java.io.BufferedOutputStream.flush(BufferedOutputStream.java:127)
>         at
>org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Ht
>tpConnection.java:799)
>         at
>org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase
>.java:2324)
>         at
>org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBa
>se.java:2657)
>         at
>org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java
>:1093)
>         at
>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:6
>75)
>         at
>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:5
>29)
>         at
>pbf.travinfo.dcol.CHPDI.AgentLibrary.getSOAPResponse(AgentLibrary.java:6
>48)
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: 
>commons-httpclient-dev-help@jakarta.apache.org