简体   繁体   English

Java中的Google App Engine API中的错误204

[英]error 204 in a Google App Engine API in java

We have an API with Googe App Engine. 我们拥有Googe App Engine的API。 The API consist on a search engine, when a user requests a productID the API returns a json with a group of other productIDs (with a specific criteria). 该API包含一个搜索引擎,当用户请求一个productID时,该API返回一个带有一组其他productID(具有特定条件)的json。 This is the current configuration: 这是当前配置:

<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>

We use app_engine_release=1.9.23 我们使用app_engine_release = 1.9.23

The process does as follows. 该过程如下。 We have two calls to datastore and a call with urlfetch (to an external API). 我们有两个对数据存储的调用和一个对urlfetch的调用(对外部API的调用)。

The problem consist on that from time to time we receive en error 204 with this trace: 问题在于,我们不时收到此跟踪的错误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. ms = 594 cpu_ms = 0 exit_code = 204 app_engine_release = 1.9.23处理该请求的进程遇到问题,导致该请求退出。 This is likely to cause a new process to be used for the next request to your application. 这很可能导致新过程用于您的应用程序的下一个请求。 (Error code 204) (错误代码204)

This is what we got in the client: 这是我们在客户中得到的:

{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": ""
}
],
"code": 503,
"message": ""
}
}

We changed the number of resident instances from 3 to 7 and we got the same error. 我们将常驻实例数从3更改为7,并且得到了相同的错误。 Also the errors occur in the same instances. 同样,错误也发生在相同的实例中。 We see 4 errors within a very small amount of time. 我们会在非常短的时间内看到4个错误。

We found that the problem was with the urlfecth call. 我们发现问题出在urlfecth调用。 If we put a high timeout, then it returns a lot of errors. 如果我们设置高超时时间,那么它将返回很多错误。

any idea why this is happening??? 知道为什么会这样吗???

I believe I have found the problem. 我相信我已经找到了问题。 The problem was related to the urlfetch call. 问题与urlfetch调用有关。 I did many tests until I isolate the problem. 我进行了许多测试,直到找出问题所在。 When i did calls only to datastore everything worked as expected. 当我只调用数据存储时,一切都按预期工作。 However when I added the urlfetch call it produced the 204 errors. 但是,当我添加urlfetch调用时,它会产生204错误。 It happened always so I believe that could be a bug. 它总是发生,所以我相信这可能是一个错误。

What I did to get rid of the error was to remove the cloud end point from Google and use a basic servlet. 为了消除该错误,我要做的是从Google删除云端点并使用基本的servlet。 I found that mixing the servlet with the urlfetch call we don't get the error, therefore the problem might not be only related to urlfetch but a combination of urlfetch and Google cloud end point. 我发现将servlet与urlfetch调用混合在一起并没有得到错误,因此问题可能不仅与urlfetch有关,而且还与urlfetch和Google云端点结合在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM