我们有一个带有 Googe App Engine 的 API。该 API 位于搜索引擎上,当用户请求 ProductID 时,API 返回包含一组其他 ProductID(具有特定条件)的 json。这是当前配置:
<instance-class>F4_1G</instance-class>
<automatic-scaling>
<min-idle-instances>3</min-idle-instances>
<max-idle-instances>automatic</max-idle-instances>
<min-pending-latency>automatic</min-pending-latency>
<max-pending-latency>automatic</max-pending-latency>
</automatic-scaling>
我们使用app_engine_release=1.9.23
该过程如下。我们有两次对数据存储的调用和一次对 urlfetch(对外部 API)的调用。
问题在于我们时不时会收到带有以下跟踪的错误 204:
ms=594 cpu_ms=0 exit_code=204 app_engine_release=1.9.23 A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 204)
这是我们在客户端中得到的:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": ""
}
],
"code": 503,
"message": ""
}
}
我们将常驻实例的数量从 3 更改为 7,但出现了相同的错误。同样的情况下也会发生错误。我们在很短的时间内发现了 4 个错误。
我们发现问题出在 urlfecth 调用上。如果我们设置较高的超时时间,则会返回很多错误。
知道为什么会发生这种情况吗???
最佳答案
我相信我已经找到问题了。该问题与 urlfetch 调用有关。我做了很多测试,直到找出问题所在。当我只调用数据存储时,一切都按预期工作。但是,当我添加 urlfetch 调用时,它产生了 204 错误。这种事总是发生,所以我相信这可能是一个错误。
为了消除该错误,我所做的就是从 Google 中删除云端点并使用基本的 servlet。我发现将 servlet 与 urlfetch 调用混合在一起不会出现错误,因此问题可能不仅与 urlfetch 有关,还与 urlfetch 和 Google 云端点的组合有关。
关于java - java 中的 Google App Engine API 中的错误 204,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31365235/