artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Apparent nested retry loops resulting in 10 minutes of retries #238

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-http-java-client (e.g. 1.15.0-rc)? 1.14.1

Java environment (e.g. Java 6, Android 2.3, App Engine)? jdk7-google-v5-64 
(running within Eclipse)

A call on Drive.Files.Update.execute() resulting in a 500 server response takes 
about 10 minutes to return. I stepped through the execution in the Eclipse 
debugger and arrived at the following state:

Thread [main] (Suspended (breakpoint at line 980 in HttpRequest))   
    HttpRequest.execute() line: 980 
    MediaHttpUploader.executeCurrentRequest(HttpRequest) line: 456  
    MediaHttpUploader.executeCurrentRequestWithBackOffAndGZip(HttpRequest) line: 478    
    MediaHttpUploader.serverErrorCallback() line: 585   
    MediaUploadExponentialBackOffPolicy.getNextBackOffMillis() line: 53 
    HttpRequest.execute() line: 1023    
    MediaHttpUploader.executeCurrentRequest(HttpRequest) line: 456  
    MediaHttpUploader.upload(GenericUrl) line: 362  
    Drive$Files$Update(AbstractGoogleClientRequest<T>).executeUnparsed(boolean) line: 420   
    Drive$Files$Update(AbstractGoogleClientRequest<T>).executeUnparsed() line: 345  
    Drive$Files$Update(AbstractGoogleClientRequest<T>).execute() line: 463  
    ...

Note that HttpRequest.execute() is, through indirect recursion, calling 
HttpRequest.execute(). The call sites are within a loop that performs 10 
retries with exponential backoff. In the inner call on HttpRequest.execute(), 
this takes about 1 minute, but it appears to me that the loop in the outer call 
is causing the inner call to be made 10 times, which would explain the 
~10-minute delay I've observed.

How would you expect it to be fixed?

The effective timeout interval should be much shorter than 10 minutes. Ideally, 
the Apiary APIs should support a way for the caller to specify a maximum 
timeout interval.

Original issue reported on code.google.com by nhcohen@google.com on 31 Jul 2013 at 7:39

GoogleCodeExporter commented 9 years ago
First of all, this would be a bug in google-api-java-client, not 
google-http-java-client.  Second, we completely changed the logic in 1.15 to 
basically turn off retries, and then we turned it back on in 1.16 with a new 
implementation.  So try it again in 1.16.

Second, with 1.16 the retry logic should be much more customizable.  So it may 
be better.

If situation hasn't improved in 1.16, please file a feature request in the 
google-api-java-client.  Note that the retry logic is a fairly complicated 
piece of the library, so your feedback is valuable.

Original comment by yan...@google.com on 31 Jul 2013 at 8:05