RE: 'Socket closed' exception using

2004-05-14 Thread Preygel, Sofya

Good morning,

I am still working on the 'socket connection' problem. According to the
Connotate tech support a possible reason of getting this exception is
that the connection is not being closed on the client, but instead,
released to the pool:

The socket closure is happening on the WMS side.  That is, since the
connection is not being closed on the client side between each
invocation, the server eventually enters an invalid state and forcibly
closes the connection.  When that happens depends on a number of things
and would appear to be almost random from the client point of view... A
verification of the connection pooling behavior or a test run with code
that guarantees closure of the connection would be needed to eliminate
it. 

I am doubtful of this explanation. I create a new HTTPClient object for
each request (using the SimpleHttpConnectionManager object), and looking
through the HTTPClient code I do not see how the connection can be
re-used in such situation. Yet you guys and the guys at Connotate
certainly know this subject better than I do, and I  an eager to try
everything. My question is: does this explanation seem plausible to you?
If yes, what would be the way to force-close the connection after the
request? Can I do this using the connection: close header params?

Thank you,
Sofya



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



RE: 'Socket closed' exception using

2004-05-14 Thread Kalnichevski, Oleg

Sofya,

It does sound dubious. There's no way a new instance of SimpleHttpConnectionManager 
can obtain an existing instance of HttpConnection. SimpleHttpConnectionManager 
*always* creates a new instance of HttpConnection. It is perfectly possible, though, 
that an open connection lingers in memory for some time until garbage collected, since 
SimpleHttpConnectionManager makes no attempts to close connections. However, I do not 
see how this may prompt the WMS to drop another connection used by a totally different 
instance of SimpleHttpConnectionManager, unless there's a bug in the WMS server-side 
connection pool code which causes the pool manager to drop active connections when MAX 
TOTAL is reached. This is a just wild guess on part, though

Since your application makes no attempt to re-use connections, you may want to send 
Connection: close directive with HTTP requests to ensure that the connection is 
immediately closed once the response is consumed. See if that helps circumvent the 
problem.

Hope this helps a little

Oleg

-Original Message-
From: Preygel, Sofya [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 16:03
To: Commons HttpClient Project
Subject: RE: 'Socket closed' exception using



Good morning,

I am still working on the 'socket connection' problem. According to the
Connotate tech support a possible reason of getting this exception is
that the connection is not being closed on the client, but instead,
released to the pool:

The socket closure is happening on the WMS side.  That is, since the
connection is not being closed on the client side between each
invocation, the server eventually enters an invalid state and forcibly
closes the connection.  When that happens depends on a number of things
and would appear to be almost random from the client point of view... A
verification of the connection pooling behavior or a test run with code
that guarantees closure of the connection would be needed to eliminate
it. 

I am doubtful of this explanation. I create a new HTTPClient object for
each request (using the SimpleHttpConnectionManager object), and looking
through the HTTPClient code I do not see how the connection can be
re-used in such situation. Yet you guys and the guys at Connotate
certainly know this subject better than I do, and I  an eager to try
everything. My question is: does this explanation seem plausible to you?
If yes, what would be the way to force-close the connection after the
request? Can I do this using the connection: close header params?

Thank you,
Sofya



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


***
The information in this email is confidential and may be legally privileged.  Access 
to this email by anyone other than the intended addressee is unauthorized.  If you are 
not the intended recipient of this message, any review, disclosure, copying, 
distribution, retention, or any action taken or omitted to be taken in reliance on it 
is prohibited and may be unlawful.  If you are not the intended recipient, please 
reply to or forward a copy of this message to the sender and delete the message, any 
attachments, and any copies thereof from your system.
***

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



RE: 'Socket closed' exception using

2004-05-14 Thread Preygel, Sofya
Oleg,

I have added the Connection: close to the HTTPPostMethod headers:
  PostMethod post = new PostMethod(m_URL);
  post.setRequestHeader(Connection, close);

It did not solve the problem, but what I cannot explain is why even
after I added this line, I do not see the HTTPConnection.close() method
being called. Am I doing something correctly? Or is the response
keep-alive option stops the HTTPClient from closing the connection. I
see the following lines in the log: Should NOT close connection in
response to Connection: Keep-Alive. Can it be that the keep-alive
option on the response header prevents the connection from being closed?

Thank you,
Sofya

-Original Message-
From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 14, 2004 10:35 AM
To: Commons HttpClient Project
Subject: RE: 'Socket closed' exception using



Sofya,

It does sound dubious. There's no way a new instance of
SimpleHttpConnectionManager can obtain an existing instance of
HttpConnection. SimpleHttpConnectionManager *always* creates a new
instance of HttpConnection. It is perfectly possible, though, that an
open connection lingers in memory for some time until garbage collected,
since SimpleHttpConnectionManager makes no attempts to close
connections. However, I do not see how this may prompt the WMS to drop
another connection used by a totally different instance of
SimpleHttpConnectionManager, unless there's a bug in the WMS server-side
connection pool code which causes the pool manager to drop active
connections when MAX TOTAL is reached. This is a just wild guess on
part, though

Since your application makes no attempt to re-use connections, you may
want to send Connection: close directive with HTTP requests to ensure
that the connection is immediately closed once the response is consumed.
See if that helps circumvent the problem.

Hope this helps a little

Oleg

-Original Message-
From: Preygel, Sofya [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 16:03
To: Commons HttpClient Project
Subject: RE: 'Socket closed' exception using



Good morning,

I am still working on the 'socket connection' problem. According to the
Connotate tech support a possible reason of getting this exception is
that the connection is not being closed on the client, but instead,
released to the pool:

The socket closure is happening on the WMS side.  That is, since the
connection is not being closed on the client side between each
invocation, the server eventually enters an invalid state and forcibly
closes the connection.  When that happens depends on a number of things
and would appear to be almost random from the client point of view... A
verification of the connection pooling behavior or a test run with code
that guarantees closure of the connection would be needed to eliminate
it. 

I am doubtful of this explanation. I create a new HTTPClient object for
each request (using the SimpleHttpConnectionManager object), and looking
through the HTTPClient code I do not see how the connection can be
re-used in such situation. Yet you guys and the guys at Connotate
certainly know this subject better than I do, and I  an eager to try
everything. My question is: does this explanation seem plausible to you?
If yes, what would be the way to force-close the connection after the
request? Can I do this using the connection: close header params?

Thank you,
Sofya



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



***
The information in this email is confidential and may be legally
privileged.  Access to this email by anyone other than the intended
addressee is unauthorized.  If you are not the intended recipient of
this message, any review, disclosure, copying, distribution, retention,
or any action taken or omitted to be taken in reliance on it is
prohibited and may be unlawful.  If you are not the intended recipient,
please reply to or forward a copy of this message to the sender and
delete the message, any attachments, and any copies thereof from your
system.

***

-
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]



RE: 'Socket closed' exception using

2004-05-14 Thread Oleg Kalnichevski
Sofya,

Connection: close in HTTP request is merely a hint which a
not-so-very-well-bred server may choose to ignore. Apparently this is
what WMS does. I am afraid your last option now is to implement a custom
HTTP connection manager that always closes connections upon release.

Oleg



On Fri, 2004-05-14 at 19:02, Preygel, Sofya wrote:
 Oleg,
 
 I have added the Connection: close to the HTTPPostMethod headers:
   PostMethod post = new PostMethod(m_URL);
   post.setRequestHeader(Connection, close);
 
 It did not solve the problem, but what I cannot explain is why even
 after I added this line, I do not see the HTTPConnection.close() method
 being called. Am I doing something correctly? Or is the response
 keep-alive option stops the HTTPClient from closing the connection. I
 see the following lines in the log: Should NOT close connection in
 response to Connection: Keep-Alive. Can it be that the keep-alive
 option on the response header prevents the connection from being closed?
 
 Thank you,
 Sofya
 
 -Original Message-
 From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] 
 Sent: Friday, May 14, 2004 10:35 AM
 To: Commons HttpClient Project
 Subject: RE: 'Socket closed' exception using
 
 
 
 Sofya,
 
 It does sound dubious. There's no way a new instance of
 SimpleHttpConnectionManager can obtain an existing instance of
 HttpConnection. SimpleHttpConnectionManager *always* creates a new
 instance of HttpConnection. It is perfectly possible, though, that an
 open connection lingers in memory for some time until garbage collected,
 since SimpleHttpConnectionManager makes no attempts to close
 connections. However, I do not see how this may prompt the WMS to drop
 another connection used by a totally different instance of
 SimpleHttpConnectionManager, unless there's a bug in the WMS server-side
 connection pool code which causes the pool manager to drop active
 connections when MAX TOTAL is reached. This is a just wild guess on
 part, though
 
 Since your application makes no attempt to re-use connections, you may
 want to send Connection: close directive with HTTP requests to ensure
 that the connection is immediately closed once the response is consumed.
 See if that helps circumvent the problem.
 
 Hope this helps a little
 
 Oleg
 
 -Original Message-
 From: Preygel, Sofya [mailto:[EMAIL PROTECTED]
 Sent: Friday, May 14, 2004 16:03
 To: Commons HttpClient Project
 Subject: RE: 'Socket closed' exception using
 
 
 
 Good morning,
 
 I am still working on the 'socket connection' problem. According to the
 Connotate tech support a possible reason of getting this exception is
 that the connection is not being closed on the client, but instead,
 released to the pool:
 
 The socket closure is happening on the WMS side.  That is, since the
 connection is not being closed on the client side between each
 invocation, the server eventually enters an invalid state and forcibly
 closes the connection.  When that happens depends on a number of things
 and would appear to be almost random from the client point of view... A
 verification of the connection pooling behavior or a test run with code
 that guarantees closure of the connection would be needed to eliminate
 it. 
 
 I am doubtful of this explanation. I create a new HTTPClient object for
 each request (using the SimpleHttpConnectionManager object), and looking
 through the HTTPClient code I do not see how the connection can be
 re-used in such situation. Yet you guys and the guys at Connotate
 certainly know this subject better than I do, and I  an eager to try
 everything. My question is: does this explanation seem plausible to you?
 If yes, what would be the way to force-close the connection after the
 request? Can I do this using the connection: close header params?
 
 Thank you,
 Sofya
 
 
 
 -
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 ***
 The information in this email is confidential and may be legally
 privileged.  Access to this email by anyone other than the intended
 addressee is unauthorized.  If you are not the intended recipient of
 this message, any review, disclosure, copying, distribution, retention,
 or any action taken or omitted to be taken in reliance on it is
 prohibited and may be unlawful.  If you are not the intended recipient,
 please reply to or forward a copy of this message to the sender and
 delete the message, any attachments, and any copies thereof from your
 system.
 
 ***
 
 -
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED

RE: 'Socket closed' exception using

2004-05-13 Thread Preygel, Sofya
Thank you, guys. I will work in this direction, i.e. investigating what
the Connotate's software does with the response, and let you know the
results.

Sofya

-Original Message-
From: Michael Becke [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 9:44 PM
To: Commons HttpClient Project
Subject: Re: 'Socket closed' exception using


Hi Sofya,

I agree with Oleg, it seems that the server is closing the connection  
in the middle of a request.

 Does not this prove that the socket  is closed from the application
 side, i.e from inside the HTTPClient? Or it is possible for the  
 HttpConnection.close() to be called when a closed socket is detected  
 (to clean up the resources, etc.)?

Yes, HttpClient closes the connection when it encounters the Exception  
while writing the request.  see  
http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/ 
httpclient/HttpMethodBase.html#2657

Mike


-
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]



Re: 'Socket closed' exception using

2004-05-12 Thread Michael McGrady
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 (1
millis), but even after I set it to 120 seconds (12 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: [EMAIL PROTECTED]
For additional commands, e-mail: 
[EMAIL PROTECTED]


RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Here it is:
  PostMethod post = new PostMethod(m_URL);
  post.setHttp11(false);
  post.setRequestHeader(Content-Length,
Integer.toString(payload.toString().length()));
  post.setRequestHeader(Content-type, text/xml;charset=utf-8);
  post.setRequestHeader(Content-type, text/xml;
charset=ISO-8859-1);
  post.setRequestHeader(SOAPAction,
http://tempuri.org/action/Agent.; + action);
  post.setRequestContentLength(payload.toString().length());
  post.setRequestBody(payload.toString());
 
I tried to also use keep-alive connection option (even though I know
it makes little sense for HTTP 1.0), but to no avail.
 
Thanks,
Sofya

-Original Message-
From: Michael McGrady [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 1:29 PM
To: Commons HttpClient Project
Cc: [EMAIL PROTECTED]; Preygel, Sofya
Subject: Re: 'Socket closed' exception using 


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 (1
millis), but even after I set it to 120 seconds (12
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

RE: 'Socket closed' exception using

2004-05-12 Thread Michael McGrady
I meant how do you set the response headers?  That is probably where the 
problem is.

At 10:32 AM 5/12/2004, Preygel, Sofya wrote:
Here it is:
  PostMethod post = new PostMethod(m_URL);
  post.setHttp11(false);
  post.setRequestHeader(Content-Length,
Integer.toString(payload.toString().length()));
  post.setRequestHeader(Content-type, text/xml;charset=utf-8);
  post.setRequestHeader(Content-type, text/xml;
charset=ISO-8859-1);
  post.setRequestHeader(SOAPAction,
http://tempuri.org/action/Agent.; + action);
  post.setRequestContentLength(payload.toString().length());
  post.setRequestBody(payload.toString());
I tried to also use keep-alive connection option (even though I know
it makes little sense for HTTP 1.0), but to no avail.
Thanks,
Sofya
-Original Message-
From: Michael McGrady [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 1:29 PM
To: Commons HttpClient Project
Cc: [EMAIL PROTECTED]; Preygel, Sofya
Subject: Re: 'Socket closed' exception using
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 (1
millis), but even after I set it to 120 seconds (12
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

Re: 'Socket closed' exception using

2004-05-12 Thread Michael Becke
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 (1
millis), but even after I set it to 120 seconds (12 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
]

And this are the response headers:
18:06:14 DEBUG [Thread-17] -  HTTP/1.1 200 OK[\r][\n]
18:06:14 DEBUG [Thread-17] -  Server: Microsoft-IIS/5.0[\r][\n]
18:06:14 DEBUG [Thread-17] -  Date: Thu, 13 May 2004 10:04:57
GMT[\r][\n]
18:06:14 DEBUG [Thread-17] -  Connection: Keep-Alive[\r][\n]
18:06:14 DEBUG [Thread-17] -  Content-Length: 45036[\r][\n]
18:06:14 DEBUG [Thread-17] -  Content-Type: text/xml;
charset=UTF-8[\r][\n]
18:06:14 DEBUG [Thread-17] -  Set-Cookie:
ASPSESSIONIDARAR=EDLBKEJANJBFEPANEPIGIOGF; path=/[\r][\n]
18:06:14 DEBUG [Thread-17] -  Cache-control: private[\r][\n]

I wonder if the HTTP version mismatch may have something to do with the
problem...

Thank you for helping out!
Sofya


-Original Message-
From: Michael Becke [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 12, 2004 4:37 PM
To: Commons HttpClient Project
Subject: Re: 'Socket closed' exception using


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 
 (1 millis), but even after I set it to 120 seconds (12 
 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: 
 [EMAIL PROTECTED]
 For additional commands, e-mail:
[EMAIL PROTECTED]
 

-
To unsubscribe, e-mail:
[EMAIL

RE: 'Socket closed' exception using

2004-05-12 Thread Preygel, Sofya
Thank you for your response, Oleg.
 
1. The application development started when the server application supported only 
HTTP1.0. 
2. The application is multi-threaded, but all HTTP requests are issued from a single 
thread. It is not the main thread, though, which I hope makes no difference as this is 
where all the HTTPClient objects are created.
3. I have contacted Connotate tech support and hope they will be able to answer some 
of the guestions about what is happening on on the server side. 
 
What I cannot understand, though, is this fragment of the log file:
  08:54:37 DEBUG [Thread-19] - Request body sent
  08:54:37 DEBUG [Thread-19] - enter .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.releaseConnection()

Does not this prove that the socket  is closed from the application side, i.e from 
inside the HTTPClient? Or it is possible for the HttpConnection.close() to be called 
when a closed socket is detected (to clean up the resources, etc.)?

Thank you!

Sofya


-Original Message- 
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] 
Sent: Wed 5/12/2004 6:41 PM 
To: Commons HttpClient Project 
Cc: 
Subject: RE: 'Socket closed' exception using



Sofya,

(1) What's the reason for using HTTP/1.0 if the target server is clearly
capable of doing HTTP/1.1?

 18:04:53 DEBUG [Thread-17] -  POST /WS/AgentLibrary.asp
 HTTP/1.0[\r][\n]



(2) Are you executing HTTP requests using multiple threads by any
chance?

(3) 'Socket closed' IO exception is usually caused when the target
server drops connection on the unsuspecting HttpClient while it is still
in the process of sending request or reading response. The problem you
have been experiencing in fact _may_ well be on the server side. If you
have access to the target server you may want to examine the server
logs.

In your case the connection to the server gets dropped as soon as
HttpClient is done sending the request body (to be more precise while
flushing the output buffer). That makes me believe that the server is
the most likely culprit, not HttpClient

Oleg


On Thu, 2004-05-13 at 00:09, Preygel, Sofya wrote:
 Hi Mike,

 Here is the code:

   PostMethod post = new PostMethod(m_URL);
   post.setHttp11(false);
   post.setRequestHeader(Content-Length,
 Integer.toString(payload.toString().length()));
   post.setRequestHeader(Content-type, text/xml;charset=utf-8);
   post.setRequestHeader(Content-type, text/xml;
 charset=ISO-8859-1);
   post.setRequestHeader(SOAPAction,
 http://tempuri.org/action/Agent.; + action);
   post.setRequestContentLength(payload.toString().length());
   post.setRequestBody(payload.toString());

   // Log the request (debug mode only)
   try
   {
  m_logger.debug(*** Request:  +
 post.getRequestBodyAsString());
   }
   catch (Exception e)
   {
   }

   // Create an instance of HttpClient
   HttpClient httpclient = new HttpClient();

   // Set the connection and socket timeouts
   int requestTimeout = m_socketTimeoutInMillis;
   httpclient.setConnectionTimeout(m_connTimeoutInMillis);
   httpclient.setTimeout(requestTimeout);
   m_logger.info (Setting HTTP timeouts: connection to  +
 m_connTimeoutInMillis +
   millis., socket to  + requestTimeout + 
 millis.);
  
   // Execute the request
   int statusCode = -1;
   for (int attempt = 1; statusCode == -1  attempt =
 m_executeRetries; attempt++)
   {
  try
  {
 statusCode = httpclient.executeMethod(post);
  }
  catch (HttpRecoverableException e)
  {
  m_logger.debug(Recoverable exception occurred while
 executing the  +
get data request:  + e.getMessage() + 
 (attempt  +
attempt +  out of  + m_executeRetries +
 ).);

 if
 (e.getMessage().startsWith

Re: 'Socket closed' exception using

2004-05-12 Thread Michael Becke
Hi Sofya,

I agree with Oleg, it seems that the server is closing the connection  
in the middle of a request.

Does not this prove that the socket  is closed from the application  
side, i.e from inside the HTTPClient? Or it is possible for the  
HttpConnection.close() to be called when a closed socket is detected  
(to clean up the resources, etc.)?
Yes, HttpClient closes the connection when it encounters the Exception  
while writing the request.  see  
http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/ 
httpclient/HttpMethodBase.html#2657

Mike

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