If there is a OOME and the application crashes, what is the default behaviour of Elastic Beanstalk; does it restart the application?
We have also put in -XX:+ExitOnOutOfMemoryError JVM flag to ensure it doesn't stay in a stuck state.
If there is a OOME and the application crashes, what is the default behaviour of Elastic Beanstalk; does it restart the application?
We have also put in -XX:+ExitOnOutOfMemoryError JVM flag to ensure it doesn't stay in a stuck state.
Elastic Beanstalk won't restart anything for you. The EB config files only runs a set of commands. If it runs out of memory during the launch process the deployment will fail.
You should use the /health domain to determine if you your instance and application is running and is working correctly. Elastic Beanstalk (Elastic Load Balancer) checks this url every minute to verify. If it doesn't get response code 200 it will terminate the instance and launch a new one.
Another option would to setup a cron job that checks so that things are running correctly and do what is necessary for it work correctly again.
The bottom thing here though seems to be that you aren't using the correct instance type for your application. Either you should optimise your application to use less memory or use a bigger instance.