AppEngine RemoteAPI SocketTimeoutException

时间:2015-12-28 18:41:16

标签: google-app-engine google-cloud-datastore

我正在使用RemoteAPI一次从GAE数据存储中获取实体。

我正在做一些事情:

while(!(emails = getEmails()).isEmpty()) {

  Filter filter = new FilterPredicate("email", FilterOperator.IN, emails)
  Query query = new Query("MyEntity").setFilter(filter);
  QueryResultIterable<Entity> result = ds.prepare(query).asQueryResultIterable();

  for (Entity entity : result) {
    System.out.println(entity.getProperty("name"));
  }
}

我正在处理类似50k的电子邮件。我第一次运行这个代码时它可能是3/4,然后它抛出了以下异常。现在它在运行单循环迭代后抛出它。

com.google.appengine.tools.remoteapi.RemoteApiException: remote API call: I/O error
at com.google.appengine.tools.remoteapi.RemoteRpc.makeException(RemoteRpc.java:160)
at com.google.appengine.tools.remoteapi.RemoteRpc.callImpl(RemoteRpc.java:104)
at com.google.appengine.tools.remoteapi.RemoteRpc.call(RemoteRpc.java:50)
at com.google.appengine.tools.remoteapi.RemoteDatastore.runQuery(RemoteDatastore.java:156)
at com.google.appengine.tools.remoteapi.RemoteDatastore.handleRunQuery(RemoteDatastore.java:115)
at com.google.appengine.tools.remoteapi.RemoteDatastore.handleDatastoreCall(RemoteDatastore.java:93)
at com.google.appengine.tools.remoteapi.RemoteApiDelegate.makeDefaultSyncCall(RemoteApiDelegate.java:57)
at com.google.appengine.tools.remoteapi.StandaloneRemoteApiDelegate.makeSyncCall(StandaloneRemoteApiDelegate.java:47)
at com.google.appengine.tools.remoteapi.StandaloneRemoteApiDelegate$1.call(StandaloneRemoteApiDelegate.java:58)
at com.google.appengine.tools.remoteapi.StandaloneRemoteApiDelegate$1.call(StandaloneRemoteApiDelegate.java:54)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:934)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:891)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:690)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1324)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.google.appengine.repackaged.com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
at com.google.appengine.repackaged.com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94)
at com.google.appengine.repackaged.com.google.api.client.http.HttpRequest.execute(HttpRequest.java:972)
at com.google.appengine.tools.remoteapi.OAuthClient.post(OAuthClient.java:54)
at com.google.appengine.tools.remoteapi.RemoteRpc.callImpl(RemoteRpc.java:102)
... 12 more

我无法弄清问题是什么,但代码似乎是在抛出异常之前评估for()条件。

这可能是配额问题吗?配额详细信息屏幕没有显示任何问题,我在文档中找不到任何相关信息。

2 个答案:

答案 0 :(得分:1)

对于此问题的未来读者,如果您发现RemoteApiException: remote API call: I/O error的出现始终如一并且不是间歇性发生,则可能与网络连接中断或App Engine端的远程问题有关。 / p>

如果排除第一种可能性,最好的做法是在Google App Engine issue tracker上报告问题。

答案 1 :(得分:0)

要解决此问题,请首先检查您的Internet连接。然后清除所有工件并再次构建它们(使用IntelliJ):

  1. 转到Build =&gt; Build Artifacts...
  2. 专注于All Artifacts =&gt; Clean
  3. 专注于All Artifacts =&gt; Build