12

I have developed an Android application using which the user can upload large files (~1 to 2 GB in size) to his/her Google Drive account.

I am using the Google Drive Rest API for Android. Sometimes, the upload operation fails with following exception:

javax.net.ssl.SSLException: Read error: ssl=0xcfe9ee80: I/O error during system call, Software caused connection abort
    at com.android.org.conscrypt.NativeCrypto.SSL_read(Native Method)
    at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:758)
    at com.android.okhttp.okio.Okio$2.read(Okio.java:141)
    at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
    at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:316)
    at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:310)
    at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:206)
    at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:239)
    at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:104)
    at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:1156)
    at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:976)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:509)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:438)
    at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:567)
    at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
    at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
    at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981)
    at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithoutGZip(MediaHttpUploader.java:545)
    at com.google.api.client.googleapis.media.MediaHttpUploader.resumableUpload(MediaHttpUploader.java:417)
    at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:336)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:427)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)

I have following questions:

  1. What are the reasons for such error?
  2. Is this the issue related to network speed?
  3. Is this is the problem with Google Drive API? If yes, how to avoid this error?

I testing the app with Android 7.0.

I would appreciate any suggestions and thoughts on this topic. Thank you.

  • 3
    Based from this [thread](https://github.com/square/okhttp/issues/3814), when the network disappears, OkHttp notifies you with an exception. If you need to retry your request, you should. OkHttp can't do that automatically because it doesn't know whether retrying will be useful. You may also check this [link](https://github.com/gggard/AndroidCaldavSyncAdapater/issues/198) for the possible resolution. – abielita Mar 27 '18 at 16:01
  • Thank you for the reply. The links were helpful to understand the problem in more detail. – Nimesh Chandramaniya Mar 28 '18 at 07:33
  • 2
    I'm experiencing this issue too, I'm using the standard Drive REST API provided by Google, so no third party libraries are involved – Antonio Papalillo Mar 26 '19 at 20:37
  • I have a same problem in retrofit post() in custom android 7.1.2 . i just recall the entire api function if same error occur. sometime the api gives response sometime the error occurs. i keep hitting api in a loop for 4 to 5 times. – Rohaitas Tanoli Jan 15 '21 at 10:46

0 Answers0