[httpClient] Timeout not being respected

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[httpClient] Timeout not being respected

Amit Shinde
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
<a href="http://localhost:8082:/xyz/control/testTimeout">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

     
Reply | Threaded
Open this post in threaded view
|

Re: [httpClient] Timeout not being respected

Rodrigo Lima-2
You need adjust ethernet timeout in your SO.


2009/7/31 Amit Shinde <[hidden email]>

> 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 <a href="http://localhost:8082:/xyz/control/testTimeout">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
>
>
>