4

我在我的 android 应用程序中使用 google cloud enpoints。当我对后端进行后调用时,有时会看到 EOFException。这并不总是发生。我有 5% 的请求出现此错误。此外,这因设备而异。某些设备比其他设备显示此错误的次数更多。这是一个错误吗?这个问题有解决方法吗?

这些是浊点使用的罐子,

google-api-client-1.14.1-beta.jar
google-api-client-android-1.14.1-beta.jar
google-http-client-1.14.1-beta.jar
google-http-client-android-1.14.1-beta.jar
google-http-client-gson-1.14.1-beta.jar
google-oauth-client-1.14.1-beta.jar

堆栈跟踪

06-10 03:53:45.057: W/System.err(1460):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-10 03:53:45.057: W/System.err(1460):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-10 03:53:45.057: W/System.err(1460):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
06-10 03:53:45.057: W/System.err(1460):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-10 03:53:45.057: W/System.err(1460):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-10 03:53:45.057: W/System.err(1460):     at java.lang.Thread.run(Thread.java:856)
06-10 03:53:45.107: W/System.err(1460): Caused by: java.io.EOFException
06-10 03:53:45.167: W/System.err(1460):     at libcore.io.Streams.readAsciiLine(Streams.java:203)
06-10 03:53:45.197: W/System.err(1460):     at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
06-10 03:53:45.288: W/System.err(1460):     at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
06-10 03:53:45.297: W/System.err(1460):     at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
06-10 03:53:45.397: W/System.err(1460):     at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495)
06-10 03:53:45.677: W/System.err(1460):     at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:134)
06-10 03:53:46.037: W/System.err(1460):     at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
06-10 03:53:46.057: W/System.err(1460):     at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:95)
06-10 03:53:46.057: W/System.err(1460):     at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:980)
06-10 03:53:46.097: W/System.err(1460):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:412)
06-10 03:53:46.198: W/System.err(1460):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:345)
06-10 03:53:46.198: W/System.err(1460):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:463)
06-10 03:53:46.247: W/System.err(1460):     at com.androidapp.android.ServerUtilities.postMessage(ServerUtilities.java:154)

将我所有的 jar 更新到最新版本,

google-api-client-1.15.0-rc.jar
google-api-client-android-1.15.0-rc.jar
google-http-client-1.15.0-rc.jar
google-http-client-android-1.15.0-rc.jar
google-http-client-gson-1.15.0-rc.jar
google-oauth-client-1.15.0-rc.jar

仍然面临同样的错误,

另外,尝试设置

System.setProperty("http.keepAlive", "false");

错误不会消失。

4

1 回答 1

0

但是,对于另一个第三方 OAuth2 提供商,我得到了同样的错误。我切换到使用 ApacheHttpTransport 并且问题消失了。

于 2014-02-07T02:36:52.927 回答