Hello Christophe,

On Fri, Apr 8, 2022 at 7:40 PM Morfin, Christophe <cmor...@ptc.com> wrote:
>
>
>
> Hi
>
> I am using Tomcat 9.0.52 and 9.0.60 on Windows server 2019 version 1809 (OS 
> Build 17763.2686)
> The machine has 32Gb of Ram
> Pagefile size 4Gb
> The Tomcat service is configured with Xms20g Xmx20g added in the Java 8 
> parameters
> I am using Amazon corretto 11.0.14
>
> Everything works fine if using Stop / Start in Control Panel > Services
> However if the service is already started and I select Restart, then it stops 
> the service but fails to start with
>
> error 1067: The process terminated unexpectedly.
>
>
> Hs-err.pid file is created with OutOfMemoryError and:
>
> There is insufficient memory for the Java Runtime Environment to continue.
> Native memory allocation (mmap) failed to map 21474836480 bytes for Failed to 
> commit area from 0x0000000300000000 to 0x0000000800000000 of length 
> 21474836480.
>

This error message indicates you are running out of Virtual
Memory(Physical Memory+Page file). When you are starting JVM with 20GB
heap, JVM will try to commit that amount. OS was not able to allocate
that much memory to JVM. How much memory was available at the time
when you restart Tomcat service?


> If setting Xms and Xmx to 16Gb, it works.
> If the pagefile size is increased to 32Gb, then it works also
Yes, this also confirms that. With 32GB page file now you have a total
of 64GB of Virtual Memory and the OS was able to happily allocate 20GB
to your JVM. With 16GB heap also you are asking less amount to
allocate.

> However we should not need that pagefile as when Tomcat is stopped, only 
> 2.5Gb out of the 32Gb are used, and it works just fine if we do the 2 step 
> process of Stop and then Start.
>
> Using other application, Zookeeper, does not show this problem, the restart 
> works ok even when set to 20Gb, so it seems something with the Tomcat service 
> management.
>

Since you mentioned it ONLY happens during restarts, I think some
other process(es) is/are consuming memory when JVM was running.

As you have a Java crash report(hs_err_pid*.log) available, can you
please post the output of the "system" section here? It'll tell us how
much memory was being used at that point. It can be found at the
bottom of that crash report.

> Any help will be appreciated
>
> Thank you
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to