Timeouts & SSL Errors w/ Google Drive API & Auth

1,853 views
Skip to first unread message

Paul Bennett

unread,
Nov 20, 2013, 8:34:46 PM11/20/13
to google-api-...@googlegroups.com
Hello:

I am receiving Socket Timeouts and SSL exceptions, sometimes frequently, when accessing the Google Auth and Google Drive APIs.  Has anyone run into this before? Does anyone have any troubleshooting advice?

I have received these errors from many different drive API calls; however, here is an example of one of them:

request = service.files().list().setQ( "mimeType='application/vnd.google-apps.folder' and trashed=false and 'root' in parents and title = '" + directory + "'" );
FileList files = request.execute();

I have received the following errors from executing this call.  Many times I do not receive any error and the call is executed quickly (<200ms?).  On many occasions I receive one of the following errors:

11-20 17:14:33.531: D/Test(7424): java.net.SocketTimeoutException: Read timed out
11-20 17:14:33.531: D/Test(7424): at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method)
11-20 17:14:33.531: D/Test(7424): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:671)
11-20 17:14:33.531: D/Test(7424): at libcore.io.Streams.readSingleByte(Streams.java:41)
11-20 17:14:33.531: D/Test(7424): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:655)
11-20 17:14:33.531: D/Test(7424): at libcore.io.Streams.readAsciiLine(Streams.java:201)
11-20 17:14:33.531: D/Test(7424): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:544)
11-20 17:14:33.531: D/Test(7424): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:784)
11-20 17:14:33.531: D/Test(7424): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
11-20 17:14:33.531: D/Test(7424): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:479)
11-20 17:14:33.531: D/Test(7424): at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:133)
11-20 17:14:33.531: D/Test(7424): at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
11-20 17:14:33.531: D/Test(7424): at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94)
11-20 17:14:33.531: D/Test(7424): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:964)
11-20 17:14:33.531: D/Test(7424): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
11-20 17:14:33.531: D/Test(7424): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)

Another example:
11-20 20:28:02.082: D/Liztic(8632): java.io.IOException: NetworkError
11-20 20:28:02.082: D/Liztic(8632): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
11-20 20:28:02.082: D/Liztic(8632): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:255)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:279)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:858)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
11-20 20:28:02.082: D/Liztic(8632): at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
11-20 20:28:02.082: D/Liztic(8632): at com.liztic.android.client.network.GoogleDriveService.authenticateIfNeeded(GoogleDriveService.java:80)
11-20 20:28:02.082: D/Liztic(8632): at com.liztic.android.client.network.GoogleDriveService.onHandleIntent(GoogleDriveService.java:185)
11-20 20:28:02.082: D/Liztic(8632): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
11-20 20:28:02.082: D/Liztic(8632): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 20:28:02.082: D/Liztic(8632): at android.os.Looper.loop(Looper.java:137)
11-20 20:28:02.082: D/Liztic(8632): at android.os.HandlerThread.run(HandlerThread.java:60)

I have also received:  javax.net.ssl.SSLException: Read error: ssl=0x1046408: I/O error during system call, Connection reset by peer

I have not run into any of these issues on another platform, so I suspect it is platform specific.

Thanks,

..Paul..

Roy

unread,
Jan 19, 2014, 3:57:22 AM1/19/14
to google-api-...@googlegroups.com
Finally, I've found somebody else seeing this

I've been seeing it for a few weeks now. It seems to affect a broad number of Google services, but generally those with an auth component.

Did you ever get any response?

Kailash chander

unread,
Nov 4, 2014, 1:24:21 PM11/4/14
to google-api-...@googlegroups.com
Hi Team,,

any solution to this?

iam also getting the same error--

aused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:579)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:270)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:327)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
        at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:77)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965)
        at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:283)
        at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)
        at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269)
        at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:489)
        at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:217)
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:859)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
        at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
        at com.hp.googlereport.common.GoogleBatchJobModule.jobScheduler(GoogleBatchJobModule.java:100)
        at com.hp.googlereport.common.GoogleBatchJobModule.execute(GoogleBatchJobModule.java:303)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

Thanks,
kailash

Daniel Wang

unread,
Nov 4, 2014, 7:55:59 PM11/4/14
to google-api-...@googlegroups.com
Hi, how often do you see this?

Kailash chander

unread,
Nov 6, 2014, 6:37:11 PM11/6/14
to google-api-...@googlegroups.com
Hi Daniel,

I have just set up the code in server and getting it. it works fine in local. Iam dealing withv aroung 8lakhs records to hit the google.
the complete job takes around 1 hours. but after 20mins or so it fails and gives the time out.. going mad on this.

Also i didnt find much help in google also.

Eric Anderson

unread,
Nov 6, 2014, 7:15:56 PM11/6/14
to google-api-...@googlegroups.com
On Tuesday, November 4, 2014 5:24:21 AM UTC-8, Kailash chander wrote:
iam also getting the same error--

The error you are getting is different, although it is feasible they have the same sort of cause.

Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)

This error is unrelated to SSL; the TCP connection wasn't established. This is a low-level problem. I wouldn't be surprised if you have a router that is misconfigured our something wrong with your host.

When you see this problem, can you access Google on the same computer from other programs? Does exiting and re-starting your application fix the problem for a while?

KC

unread,
Nov 6, 2014, 7:28:46 PM11/6/14
to google-api-...@googlegroups.com
Hi Eric,

Thanks for your support.

Iam not sure if iam out of conbtext here.. But i am trying to use the service account and then access the report/directory aPI

The kind of error i have is at the below Stack


We kind of dealing with huge data using service account... but the call to google works fine for say 30minutes and then times out and gives the error i have mentioned in above 
stack overflow questions.

Yes, it did work for sometime when we query for less data... but again failed when we want to retrieve the complete data. this works fine when i run through local eclipse.

Thanks mate.

Eric Anderson

unread,
Nov 11, 2014, 10:27:04 PM11/11/14
to google-api-...@googlegroups.com
I really did want these questions answered, as best as you can:
When you see this problem, can you access Google on the same computer from other programs? Does exiting and immediately re-starting your application fix the problem for a while?

Your post just confuses me a bit, because it is as a solution to another problem, but doesn't directly relate to the "similar error" that you posted to this list.

The fact that it works on one machine but not on another is generally pretty telling that something is wrong with your environment. If you aren't pulling all data when using Eclipse, then maybe you issuing too many requests in parallel or not doing exponential backoff on errors?

--
You received this message because you are subscribed to the Google Groups "google-api-java-client" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-api-java-c...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages