I have Apache Tomcat running on an PROD EC2 instance managed by Elastic Beanstalk.
Every five to six hours, incoming requests would fail with the error
java.lang.OutOfMemoryError: Unable to create new native thread
I initially thought that raising the JVM Heap Size in the EB configuration from the default of 256m
to 1024m
would help to alleviate the issue, but it still recurs.
Naturally, as my UAT environment does not have the load factor of the PROD environment, this issue did not crop up in UAT.
As the EC2 instances are sitting behind a bastion host, I'm not able to directly connect to it with VisualVM or other memory profiling tools.
Can anyone suggest how I should go about finding out what is causing this and resolving it once and for all?