1

我们目前正在使用捆绑服务(https://cloud.google.com/blog/products/serverless/support-for-app-engine-services-in-second-generation- )将我们的 App Engine 从 Java 8 迁移到 Java 11运行时)。

我们做到了,应用程序似乎按预期运行 - BE、FE 和 Datastore 似乎都在我们的暂存 GCP 项目中工作。

但是,我们的日志中每 10 秒就会出现以下错误:

Failed to query GCE metadata service

接着

java.io.IOException: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call urlfetch.Fetch in a thread that is neither the original request thread nor a thread created by ThreadManager
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:70)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:609)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:488)
at com.google.devtools.cdbg.debuglets.java.GceMetadataQuery.readResponse(Unknown Source)
at com.google.devtools.cdbg.debuglets.java.GceMetadataQuery.queryMetadataAttribute(Unknown Source)
at com.google.devtools.cdbg.debuglets.java.GceMetadataQuery.getProjectId(Unknown Source)
at com.google.devtools.cdbg.debuglets.java.GcpHubClient.registerDebuggee(Unknown Source)
Caused by: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call urlfetch.Fetch in a thread that is neither the original request thread nor a thread created by ThreadManager
at com.google.apphosting.api.ApiProxy$CallNotFoundException.foreignThread(ApiProxy.java:844)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:117)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:54)
... 6 more

编辑:云调试器说“调试器找不到应用程序的调试目标”。不过,这些版本仍然依赖于 Java 8 工作,那么迁移缺少什么额外的步骤来正确设置调试器?由于我们使用的是 App Engine 标准环境,因此应该默认启用 ( https://cloud.google.com/debugger/docs/setup/java#gae-standard )。

编辑 2:看起来这可能是 Google Cloud Debugger 错误: https ://github.com/GoogleCloudPlatform/cloud-debug-java/issues/18

4

1 回答 1

1

根据有关发出 HTTP 请求的 App Engine 文档,如果您使用 URL Fetch,它将导致对云客户端库(包括适用于 Java 的 Google Cloud Debugger Client)的请求失败。

由于我们正在使用捆绑服务,我们仍在使用appengine-web.xml文件。

我们在那里有以下行:

<url-stream-handler>urlfetch</url-stream-handler>

删除该行为我们解决了这个问题。

于 2021-10-22T12:09:57.350 回答