OOM Exceptions during startup

Hello,
I am running Flowable on an EC2 instance (m4.large) with 2 vCPU and 8 GB RAM. It was performing without any glitch until I now - when I am unable to boot the Tomcat8 server running Flowable.
I continuously see these OutOfMemoryError: Java heap space exceptions.

Any suggestions on how I can debug and fix these exceptions? Is there an recommended hardware configuration that is recommended OR a type of EC2 instance that is recommended?

Exception in thread "flowable-acquire-timer-jobs" java.lang.OutOfMemoryError: Java heap space
Exception in thread "flowable-reset-expired-jobs" java.lang.OutOfMemoryError: Java heap space

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Abandoned connection cleanup thread"
Oct 22, 2017 2:45:13 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat8/webapps/flowable-idm.war
Oct 22, 2017 2:45:13 PM org.apache.catalina.startup.HostConfig deployWARs
SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:731)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1542)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:286)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:339)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:933)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space

Oct 22, 2017 2:45:18 PM org.apache.catalina.startup.HostConfig deployWARs
SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:731)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:400)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1542)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:286)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:339)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:933)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space

Oct 22, 2017 2:45:20 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat8/webapps/ROOT
Oct 22, 2017 2:45:27 PM org.apache.catalina.startup.HostConfig deployDirectories
SEVERE: Error waiting for multi-thread deployment of directories to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1010)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:402)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1542)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:286)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:394)
        at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:339)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:933)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space

Oct 22, 2017 2:45:33 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]

Just to clarify, there is about 7 GiB of free memory and 4.2GiB of diskspace (without swap) to say that there is plenty of resources available when this happens.

Hi,

Did you increase the memory settings of Tomcat 8?
You could try to increase the values of -Xms, -Xmx and -XX:PermSize.
That the EC2 instance has a lot of free memory doesn’t say anything, because Tomcat will use the -Xms, -Xmx and -XX:PermSize values.

Best regards,

Tijs

Thanks @tijs,
Increasing the values of -Xms, -Xmx and -XX:PermSize fixed the issue.