GAE :Process terminated because the backend took too long to shut down in backends job

我是研究僧i 提交于 2019-12-10 12:47:26

问题


My backend job is working on the basis of cron job(every 4 hour).But it is terminated with out processing the data. The server log displays as following :

500 15377121ms 0kb instance=0 AppEngine-Google; (+http://code.google.com/appengine)
E 2012-10-05 01:50:18.044 Process terminated because the backend took too long to shutdown.

How to handle this kind of error in my program


回答1:


That error is generated when App Engine needs to shut your backend down but the backend fails to exit within 30 seconds. Some reasons why this might be happening are listed here. Depending on the type of error, App Engine may be sending your backend a notification of the impending shutdown, so it's a good idea to register a shutdown handler so you can gather more data about your app's state when this is about to happen.

If you are seeing this regularly there is probably a systematic explanation, such as your job's memory exceeding the maximum for the backend's class.




回答2:


Dealing with the same issue. Looked at the causes listed in the official docs. Memory consumption seems ok from statistics. Datastore contention issues are also handled in my code. Timeouts too. Changing the task mechanism to work in recoverable chunks seems the only way out.

After chasing this error for sometime now, it seems AppEngine development paradigm revolves around url handlers with limitations on time, memory etc. This is applicable to long running tasks too. I redid my long term task to be executed small tasks. Task queues triggered smaller tasks which inturn run, before finish queue the next task. Never failed even once!

The advantage is that taskqueuus have better failsafe/handover than just a huge cron job. One task failing does not mean the rest of the huge task list fail.



来源:https://stackoverflow.com/questions/12739411/gae-process-terminated-because-the-backend-took-too-long-to-shut-down-in-backen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!