Critical Worker Timeout 502 error

1,924 views
Skip to first unread message

Udit Sharma

unread,
Jul 14, 2017, 11:52:00 AM7/14/17
to Google App Engine

I deployed my application to the cloud server build using Flask, but now I am getting the 502 errors as a response. Same code is running fine on my local server host. I am taking some file as an input where the largest file is of 80 mb only. I tried with both deploying the files with the code and also storing them on cloud storage and downloading using URL during the runtime. I keep getting the same error at log both the time. I have attached the error screenshots.


Please help in solving this issue, I guess it is because of Nginx timeout ( not sure though ). I followed this link but could not implement it like stated here. Please help!








Kenworth (Google Cloud Platform)

unread,
Jul 14, 2017, 7:23:32 PM7/14/17
to Google App Engine
[CRITICAL] WORKER TIMEOUT (pid:xxx) gunicorn errors usually indicates the WSGI webserver (gunicorn) closed the request early, due to worker timeout. I suspect you're hitting the default timeout value for gunicorn sync workers. The timeout value limits the length of requests and the potential fix would be to test this by changing your app.yaml entrypoint to include ‘--graceful-timeout 75’ and/or ‘--timeout 75’. This will set the timeouts to 75 seconds [1]. 

If the above troubleshooting step did not resolve your issue, please try / send the following:
1. Send your "app.yaml" privately
1. Increase resource (e.g. CPU)
2. Implement Exponential Backoffyour app almost instantaneously retries to reboot after fail. Implementing this makes sure that the server is not overwhelmed with requests hitting at the same time when it comes back up. 
3. gunicorn logs -> it does not log by default. To watch the logs in the console you need to use the option “--log-file=-” or “--log-level=DEBUG” to give you an app stack trace. 

Please also note that for specific technical questions not related to Google Cloud Platform (like Flask or nginx), I would recommend posting a question to StackExchange / StackOverflow and tagging the appropriate topic.

[1] 75 seconds is arbitrary, set it to higher timeout as necessary. 
Reply all
Reply to author
Forward
0 new messages