This occurs when your actual application becomes too busy to respond to the nginx server Docker container that sits in front of your application Docker container within the instance. Nginx will send health checks <https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml#health_checks> to your application in order to make sure it is responsive so that it may accept new requests. If your code blocks the main thread for too long, nginx will not receive any response from your app and will assume it is not healthy. This will produce a 502 Bad Gateway error when App Engine asks nginx if the application is ready to accept new requests, and the instance will be restarted in order to make it healthy again.
It is therefore recommended to increase the number of instances you have (as I assume you are limiting your max to a very low number like one), and to ensure your code is properly configured to handle concurrent requests, returns quickly, and does not block the main thread for too long. You can also configure the health checks <https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml#updated_health_checks> as to not render your instance as unhealthy so quickly and to give it more time to recover from traffic spikes. - Note that Google Groups is reserved for general product discussions and not for technical support. For further technical support it is recommended to post your detailed questions <https://stackoverflow.com/help/how-to-ask> to Stack Overflow <https://cloud.google.com/support/docs/stackexchange> using the supported Cloud tags. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/6eeeb811-c24f-48b4-95f6-1b5ffb08b5de%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
