You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sébastien Geindre <se...@meteo.fr> on 2007/12/04 17:53:27 UTC

socket time out

hi all,

i have a pb with socket established by httpclient.
they fall down after 10 seconds !

PostMethod post = new PostMethod("http://.....");
post.getParams().setSoTimeout(new Integer(150000));

2007-12-04 17:40:38,780 main TRACE methods.EntityEnclosingMethod - enter 
EntityEnclosingMethod.hasRequestContent()
2007-12-04 17:40:38,780 main TRACE httpclient.HttpConnection - enter 
HttpConnection.getRequestOutputStream()
2007-12-04 *17:40:48*,807 main DEBUG httpclient.HttpMethodDirector - 
Closing the connection.
2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter 
HttpConnection.close()
2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter 
HttpConnection.closeSockedAndStreams()
2007-12-04 17:40:48,808 main DEBUG transformer.WFSProxyHttpClient - 
HttpMethodRetryHandler Exception : Broken pipe


10 second after the first write on the socket, it fall down.


any idea ???

The server needs more than 10 seconds to process the service...I know 
it's too long...
thanks

-- 
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr



Re: socket time out

Posted by Roland Weber <os...@dubioso.net>.
Hello Sébastien,

> i have set a low level of debug, and it's better; but still drop the
> connection sometimes.

Have you found a correlation between input data and the connections
being dropped? Is it a particular request for which the connection
is dropped, or does the same request sometimes go through and other
times fail? A correlation with load on the server or network?

> how can i monitor jetty thread ?

It's just an idea that there might be such a thread. Or maybe
some timeout settings on the server socket. Please ask Jetty
questions on a Jetty mailing list.

> i put the breakpoint because i does not work in 'normal' environment.

Does not work reproducibly (depends on the request being sent)
or does not work sporadically (timing problem)?

cheers,
  Roland


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


Re: socket time out

Posted by Sébastien Geindre <se...@meteo.fr>.
Roland Weber a écrit :
> Hello Sébastien,
>
>   
>> i start the small client
>> i see the server stopped at the breakpoint.
>>
>> i just do nothing, every body is waiting.
>> and after 10 seconds, the connection dropped !!
>>     
>
> You don't expect the system to behave normally when
> you stop the service thread with a break point, do you?
> If the request size plays a role, then probably some
> buffer runs full, while with a small request everything
> fits into the buffer. If the 10 second delay is
> reproducible with different sizes of large requests,
> I would go looking for a monitor thread in Jetty that
> kills connections or hanging service threads.
>   
i tried several size of request. It always around 10 seconds...but 
sometimes it does on.
i have set a low level of debug, and it's better; but still drop the 
connection sometimes.

how can i monitor jetty thread ?
> Remove the breakpoint, see if the code works then.
> If it does, the problem is in your server debugging
> environment.
>   
i put the breakpoint because i does not work in 'normal' environment.
> hope that helps,
>   
discussing always help ! :-)
thank again
>   Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>   


-- 
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr




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


Re: socket time out

Posted by Roland Weber <os...@dubioso.net>.
Hello Sébastien,

> i start the small client
> i see the server stopped at the breakpoint.
> 
> i just do nothing, every body is waiting.
> and after 10 seconds, the connection dropped !!

You don't expect the system to behave normally when
you stop the service thread with a break point, do you?
If the request size plays a role, then probably some
buffer runs full, while with a small request everything
fits into the buffer. If the 10 second delay is
reproducible with different sizes of large requests,
I would go looking for a monitor thread in Jetty that
kills connections or hanging service threads.

Remove the breakpoint, see if the code works then.
If it does, the problem is in your server debugging
environment.

hope that helps,
  Roland


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


Re: socket time out

Posted by Sébastien Geindre <se...@meteo.fr>.
>
> So the socket doesn't fall down after 10 seconds (which would
> indicate a timeout problem) but when the request is sent and
> a response would be expected. This indicates that either the
> server or (more likely) some firewall inbetween doesn't like
> the request you are sending and simply drops the connection.
> A server would be expected to send a 4xx response, that's why
> I suspect a firewall. We had one case where a firewall didn't
> like the "User-Agent" header that HttpClient sends by default.
> Replacing that with the User-Agent of some well-known browser
> solved the problem.
>
>   
>> the post is an xml post of data, quite heavy...
>> 646213  bytes of data, is too heavy ?
>>     
>
> The size of the data is not the problem.
>
> a) Can you test with smaller or larger XML data?
> That would help to verify that it is not a timeout problem
> but occurs always after the full request is sent.
>   
with smaller data, there is no pb !!!
that's why t thought about kind of timeout on the socket...

i have my web server on one side, started in debug way with breakpoint.

i have my small httpclient on the other side, making a simple post request.

i start the small client
i see the server stopped at the breakpoint.

i just do nothing, every body is waiting.
and after 10 seconds, the connection dropped !!

mays be because i started the web server with jetty....
i am lost.
thank to try helping me !
> b) Do you have another application that successfully
>    communicates with that server?
> Then you could compare a request sent by that application
> with the request sent by your application.
>
> hope that helps,
>   Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>   


-- 
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr




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


Re: socket time out

Posted by Roland Weber <os...@dubioso.net>.
Hello Sébastien,

>>> 2007-12-04 17:40:38,780 main TRACE httpclient.HttpConnection - enter
>>> HttpConnection.getRequestOutputStream()
>> (*)
>>> 2007-12-04 *17:40:48*,807 main DEBUG httpclient.HttpMethodDirector -
>>> Closing the connection.
>>> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
>>> HttpConnection.close()
>>> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
>>> HttpConnection.closeSockedAndStreams()
>>> 2007-12-04 17:40:48,808 main DEBUG transformer.WFSProxyHttpClient -
>>> HttpMethodRetryHandler Exception : Broken pipe
>>   
> no nothing between this 2 steps...no trace...
> in fact in the code :
>        OutputStream outstream = conn.getRequestOutputStream();
>              if (contentLength < 0) {
>            outstream = new ChunkedOutputStream(outstream);
>        }
>              requestEntity.writeRequest(outstream);
> 
> so it took time to write the request...

So the socket doesn't fall down after 10 seconds (which would
indicate a timeout problem) but when the request is sent and
a response would be expected. This indicates that either the
server or (more likely) some firewall inbetween doesn't like
the request you are sending and simply drops the connection.
A server would be expected to send a 4xx response, that's why
I suspect a firewall. We had one case where a firewall didn't
like the "User-Agent" header that HttpClient sends by default.
Replacing that with the User-Agent of some well-known browser
solved the problem.

> the post is an xml post of data, quite heavy...
> 646213  bytes of data, is too heavy ?

The size of the data is not the problem.

a) Can you test with smaller or larger XML data?
That would help to verify that it is not a timeout problem
but occurs always after the full request is sent.

b) Do you have another application that successfully
   communicates with that server?
Then you could compare a request sent by that application
with the request sent by your application.

hope that helps,
  Roland

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


Re: socket time out

Posted by Sébastien Geindre <se...@meteo.fr>.
Roland Weber a écrit :
> Hello Sébastien,
>
> this doesn't look like a full trace to me:
>
>   
>> 2007-12-04 17:40:38,780 main TRACE methods.EntityEnclosingMethod - enter
>> EntityEnclosingMethod.hasRequestContent()
>> 2007-12-04 17:40:38,780 main TRACE httpclient.HttpConnection - enter
>> HttpConnection.getRequestOutputStream()
>>     
> (*)
>   
>> 2007-12-04 *17:40:48*,807 main DEBUG httpclient.HttpMethodDirector -
>> Closing the connection.
>> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
>> HttpConnection.close()
>> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
>> HttpConnection.closeSockedAndStreams()
>> 2007-12-04 17:40:48,808 main DEBUG transformer.WFSProxyHttpClient -
>> HttpMethodRetryHandler Exception : Broken pipe
>>     
>
> What's going on around (*)? Is the request body written correctly?
> Any IOExceptions? Feel free to remove actual data of the body, but
> please provide the parts of the log that tell us what's happening.
>   
no nothing between this 2 steps...no trace...
in fact in the code :
        OutputStream outstream = conn.getRequestOutputStream();
       
        if (contentLength < 0) {
            outstream = new ChunkedOutputStream(outstream);
        }
       
        requestEntity.writeRequest(outstream);

so it took time to write the request...
the post is an xml post of data, quite heavy...
646213  bytes of data, is too heavy ?
> cheers,
>   Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>   


-- 
Sébastien Geindre
DPREVI/AERO/DEV
sebastien.geindre __at__ meteo.fr




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


Re: socket time out

Posted by Roland Weber <os...@dubioso.net>.
Hello Sébastien,

this doesn't look like a full trace to me:

> 2007-12-04 17:40:38,780 main TRACE methods.EntityEnclosingMethod - enter
> EntityEnclosingMethod.hasRequestContent()
> 2007-12-04 17:40:38,780 main TRACE httpclient.HttpConnection - enter
> HttpConnection.getRequestOutputStream()
(*)
> 2007-12-04 *17:40:48*,807 main DEBUG httpclient.HttpMethodDirector -
> Closing the connection.
> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
> HttpConnection.close()
> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter
> HttpConnection.closeSockedAndStreams()
> 2007-12-04 17:40:48,808 main DEBUG transformer.WFSProxyHttpClient -
> HttpMethodRetryHandler Exception : Broken pipe

What's going on around (*)? Is the request body written correctly?
Any IOExceptions? Feel free to remove actual data of the body, but
please provide the parts of the log that tell us what's happening.

cheers,
  Roland

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


Re: socket time out

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-12-04 at 17:53 +0100, Sébastien Geindre wrote:
> hi all,
> 
> i have a pb with socket established by httpclient.
> they fall down after 10 seconds !
> 
> PostMethod post = new PostMethod("http://.....");
> post.getParams().setSoTimeout(new Integer(150000));
> 
> 2007-12-04 17:40:38,780 main TRACE methods.EntityEnclosingMethod - enter 
> EntityEnclosingMethod.hasRequestContent()
> 2007-12-04 17:40:38,780 main TRACE httpclient.HttpConnection - enter 
> HttpConnection.getRequestOutputStream()
> 2007-12-04 *17:40:48*,807 main DEBUG httpclient.HttpMethodDirector - 
> Closing the connection.
> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter 
> HttpConnection.close()
> 2007-12-04 17:40:48,807 main TRACE httpclient.HttpConnection - enter 
> HttpConnection.closeSockedAndStreams()
> 2007-12-04 17:40:48,808 main DEBUG transformer.WFSProxyHttpClient - 
> HttpMethodRetryHandler Exception : Broken pipe
> 

'Broken pipe' usually meant the other side (the target host in your case
or a proxy in between) terminated the connection. 

Oleg

> 
> 10 second after the first write on the socket, it fall down.
> 
> 
> any idea ???
> 
> The server needs more than 10 seconds to process the service...I know 
> it's too long...
> thanks
> 


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