You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Amit Shinde <am...@amicontech.com> on 2009/07/31 21:05:41 UTC

[httpClient] Timeout not being respected

Hello Everyone,
        I am using the UPS external 'upsRateEstimate' service to get 
shipping estimates and we all know that the service does not work 
consistently every time. Sometimes the http request does not respond and 
the transaction times out in exactly 2 minutes. I used 
'shipment.ups.connect.timeout' property but it does not seem to work. If 
I understand correctly, this property should break the connection if 
server takes too long to respond. After digging deeper in HttpClient and 
URLConnector class, it looks like the connection thread does not get 
interrupted with the set timeout.

       I tested this pretty comprehensively. Heres what I did. I ran 2 
ofbiz instances locally (client at 8080 and server at 8082 ) and changed 
the UPS URL of client to point to 
http://localhost:8082:/xyz/control/testTimeout. We have a request 
handler for testTimeout inside which we make the thread to sleep for a 
period much longer than the set timeout value to replicate the actual 
scenario. The timeout did not seem to work at all. Looks like the 
URLConnectorThread and openConnection logic might not be working.

       I might be completely wrong but the only way I could get this to 
work is by setting read timeout of URLConnection by calling 
setReadTimeout method explicitly.

       Any thoughts or inputs are appreciated.

Thanks,
Amit Shinde

     

Re: [httpClient] Timeout not being respected

Posted by Rodrigo Lima <ac...@gmail.com>.
You need adjust ethernet timeout in your SO.


2009/7/31 Amit Shinde <am...@amicontech.com>

> Hello Everyone,
>       I am using the UPS external 'upsRateEstimate' service to get shipping
> estimates and we all know that the service does not work consistently every
> time. Sometimes the http request does not respond and the transaction times
> out in exactly 2 minutes. I used 'shipment.ups.connect.timeout' property but
> it does not seem to work. If I understand correctly, this property should
> break the connection if server takes too long to respond. After digging
> deeper in HttpClient and URLConnector class, it looks like the connection
> thread does not get interrupted with the set timeout.
>
>      I tested this pretty comprehensively. Heres what I did. I ran 2 ofbiz
> instances locally (client at 8080 and server at 8082 ) and changed the UPS
> URL of client to point to http://localhost:8082:/xyz/control/testTimeout.
> We have a request handler for testTimeout inside which we make the thread to
> sleep for a period much longer than the set timeout value to replicate the
> actual scenario. The timeout did not seem to work at all. Looks like the
> URLConnectorThread and openConnection logic might not be working.
>
>      I might be completely wrong but the only way I could get this to work
> is by setting read timeout of URLConnection by calling setReadTimeout method
> explicitly.
>
>      Any thoughts or inputs are appreciated.
>
> Thanks,
> Amit Shinde
>
>
>