error 204 in a Google App Engine API in java

2019-07-21 11:48发布

We have an API with Googe App Engine. 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). 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

The process does as follows. We have two calls to datastore and a call with urlfetch (to an external API).

The problem consist on that from time to time we receive en error 204 with this trace:

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)

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. Also the errors occur in the same instances. We see 4 errors within a very small amount of time.

We found that the problem was with the urlfecth call. If we put a high timeout, then it returns a lot of errors.

any idea why this is happening???

1条回答
Viruses.
2楼-- · 2019-07-21 12:37

I believe I have found the problem. The problem was related to the urlfetch call. 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. 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. 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.

查看更多
登录 后发表回答