bearyg / google-api-java-client

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

SocketTimeoutException when uploading big files to Google Drive #853

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
google-api-java-client 1.15.0-rc

Java environment:  Java 5

When I try upload file ~1.5Gb to Google Drive I've got 
java.net.SocketTimeoutException.
I use MediaHttpUploader in resumeable mode + configured IOExceptionHandler and 
UnsuccessfulResponseHandler with ExponentialBackOff:
HttpBackOffUnsuccessfulResponseHandler responseHandler = new 
HttpBackOffUnsuccessfulResponseHandler(new ExponentialBackOff());
request.setUnsuccessfulResponseHandler(responseHandler);
request.setIOExceptionHandler(new HttpBackOffIOExceptionHandler(new 
ExponentialBackOff()));
request.setConnectTimeout(40000);
request.setReadTimeout(100000);

So file started uploading by chunks and after some time GDrive could fire 
exception indicating that token expiration or any other exception could happen. 
So MediaUploader is trying to retry request. It sends it again (token refreshed 
successfully) but got timeout exception, then backoff is triggered and it 
request was sent again, bug got same result - socket timeout. It tries 10 
times, overall several minutes - same effect. So upload is canceled and our 
application, after some time, tries to repeat file upload, but same issue rised 
again - in case any errors happened while file uploading, socket timeout 
exception thrown and no chance to resume uploading.
I've attached

Original issue reported on code.google.com by ArmenPol...@gmail.com on 15 Jan 2014 at 10:43

Attachments: