AWS: There is insufficient memory for the Java Runtime Environment to continue

10,620

According to the error message in your update, it seems like you tried to adjust the JVM permanent generation size. Try to leave this setting to whatever the default is. Instead, set both the initial and the maximum heap size to 64mb.

If it is still crashing, once it crashed, you can ssh to the AWS instance and look at what is using the memory. In beanstalk, in the configurations of your environment, under "Instances", you can select the keypair you want to use with your instances. You can find the instances launched by beanstalk in the EC2 console, like any other instance.

Share:
10,620
Richard
Author by

Richard

Updated on June 04, 2022

Comments

  • Richard
    Richard almost 2 years

    I am running a 64bit Amazon Linux 2016.09 v2.5.2 running Tomcat 8 Java 8 environment on AWS Elasticbeanstalk free tier (Instance type: t1.micro).

    I have a number of RESTful services, when one particular service is called, that does some work, I consistently get a 502 error, and the following in the logs:

    OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e2220000, 130215936, 0) failed; error='Cannot allocate memory' (errno=12)

    There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 130215936 bytes for committing reserved memory. An error report file with more information is saved as: /tmp/hs_err_pid31500.log OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=64m; support was removed in 8.0

    Question

    Does this mean I need to upgrade to a payed version, i.e. greater than Instance type: t1.micro?

    Or, is there a way I can configure my environment to handle this?

    The reason I ask, is because the logs above indicate that the Java App is requiring only 130mb (130215936 bytes) of memory, where below you can see the JVM heap size is a lot larger. So I would not have expected it to fall over at 130mb.

    More Info

    I do have the following configurations settings:

    enter image description here

    Thanks

    UPDATE

    I change the Max JVM to 256mb, but still get the error:

    OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 89456640, 0) failed; error='Cannot allocate memory' (errno=12)

    There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 89456640 bytes for committing reserved memory. An error report file with more information is saved as: /tmp/hs_err_pid14014.log OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

    But here it falls over on only 89mb.