You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Morfin, Christophe" <cm...@ptc.com> on 2022/04/08 14:09:47 UTC

Tomcat service does not restart on Windows with high value of Xms/Xmx


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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also
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.

Any help will be appreciated

Thank you
Chris


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


Re: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Christophe,

On 4/8/22 12:57, Morfin, Christophe wrote:
> Hi
> 
> Thank you for your answers,
> 
> Here below is the output of system part of hs_err file.
> 
> 
> Note though If I execute a manual stop and manual start immediately after, this work, no issue.
> It is only when I use the Restart option.
> 
> Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
> When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.
> 
> I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
> I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
> Let me know if you are interested about it.

You say you are using the Windows Services snap-in to restart this 
service. Is that using the standard Tomcat Service runner (procrun.exe / 
tomcatX.exe) to launch it?

One of the things that needs to be passed to that service-runner is the 
heap settings. When running from the command-line (typical for a *NIX 
deployment), there are two separate environment variables used for this 
purpose: CATALINA_OPTS and JAVA_OPTS.

JAVA_OPTS are passed to all invocations of the JVM, including the one 
that just launches a tiny Java thread to connect to the running Tomcat 
and give the "shutdown" command. CATALINA_OPTS is used only when 
*starting* Tomcat.

So if you put huge heap settings in JAVA_OPTS, your "shutdown" process 
allocates a huge heap for no reason. So it's best to put things like 
that into CATALINA_OPTS so you only get a huge heap for the real Tomcat 
service process.

Back to Windows Services.

If the "heap settings" are applying to both "startup" and "shutdown" 
processes, then your shutdown command may be allocating a large heap. If 
"shutdown" takes a few seconds, and "startup" happens while the old JVM 
is still running, you may have a situation where not everything can fit 
into memory all at once.

When you "stop" then "start", you may be adding enough of a a 
human-delay to that process so that the old JVM and the new JVM aren't 
running at the same time, so there is enough free memory to launch the 
new process.

-chris

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


RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by "Morfin, Christophe" <cm...@ptc.com>.
Hi

I was just wondering if there is some further update/suggestion on this issue ?

Thank you
Kind regards
Christophe



Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe 
Sent: 12 April 2022 15:19
To: users@tomcat.apache.org
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

Thank you

I do have the same behaviour if I set Xms/Xmx in the Java Option or if I set the Initial and Maximum memory pool (I removed Xms/Xmx from Java Option for that test) I really think it would be interesting if you could test on a Win 2019 with 32Gb of RAM as  I would think you should be able to reproduce since I have had several reports of this issue now.

Thank you
Kind regards
Christophe



Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe
Sent: 12 April 2022 11:26
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

As additional information I have done further testing

Windows 2016 32Gb RAM
Xms/Xmx 20g
Pagefile 5g

Service restart works fine

Same configuration on Windows 2019, restart fails with mentioned memory issue.

Windows 2019 8gb RAM
Xms/Xmx 7g
Pagefile 2g
Restart works fine

So it seems to happen only on Windows 2019 with larger heap size.

Note that this was reported to me by others, so it appears to be easily reproducible .
I wonder if you would have a chance to test on a Windows 2019 , 64 bit Build 17763 (10.0.17763.2686) with above mentionned configuration as  I feel you would reproduce.

Thank you
Kind regards
Christophe



          

-----Original Message-----
From: Morfin, Christophe
Sent: 11 April 2022 09:38
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi Chris

Thank you for the information, this is interesting indeed.
Yes, I am using the default service installed by Tomcat installer so using procrun and tomcat9.exe

I have tried adding -DCATALINA_OPTS="-Xms20g -Xmx20g" under the Java Options parameters in tomcat9w.exe > Java tab But this is not taken into account

When I google this, it seems we can't set CATALINA_OPTS when starting as a service

Do you have further details on how to set CATALINA_OPTS when starting a service ?

Thank you
Kind regards
Christophe


         

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 17:57
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

Thank you for your answers,

Here below is the output of system part of hs_err file.


Note though If I execute a manual stop and manual start immediately after, this work, no issue.
It is only when I use the Restart option.

Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.

I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
Let me know if you are interested about it.

Thank you
Christophe



---------------  S Y S T E M  ---------------

OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686) OS uptime: 0 days 8:03 hours Hyper-V role detected

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma

Memory: 4k page, system-wide physical 32767M (30013M free) TotalPageFile size 37631M (AvailPageFile size 14413M) current process WorkingSet (physical memory assigned to process): 12M, peak: 12M current process commit charge ("private bytes"): 61M, peak: 20541M

vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916

END.


Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 15:10
To: users@tomcat.apache.org
Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx



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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also 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.

Any help will be appreciated

Thank you
Chris


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


RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by "Morfin, Christophe" <cm...@ptc.com>.
Hi

Thank you

I do have the same behaviour if I set Xms/Xmx in the Java Option or if I set the Initial and Maximum memory pool (I removed Xms/Xmx from Java Option for that test)
I really think it would be interesting if you could test on a Win 2019 with 32Gb of RAM as  I would think you should be able to reproduce since I have had several reports of this issue now.

Thank you
Kind regards
Christophe



Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe 
Sent: 12 April 2022 11:26
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

As additional information I have done further testing

Windows 2016 32Gb RAM
Xms/Xmx 20g
Pagefile 5g

Service restart works fine

Same configuration on Windows 2019, restart fails with mentioned memory issue.

Windows 2019 8gb RAM
Xms/Xmx 7g
Pagefile 2g
Restart works fine

So it seems to happen only on Windows 2019 with larger heap size.

Note that this was reported to me by others, so it appears to be easily reproducible .
I wonder if you would have a chance to test on a Windows 2019 , 64 bit Build 17763 (10.0.17763.2686) with above mentionned configuration as  I feel you would reproduce.

Thank you
Kind regards
Christophe



          

-----Original Message-----
From: Morfin, Christophe 
Sent: 11 April 2022 09:38
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi Chris

Thank you for the information, this is interesting indeed.
Yes, I am using the default service installed by Tomcat installer so using procrun and tomcat9.exe

I have tried adding -DCATALINA_OPTS="-Xms20g -Xmx20g" under the Java Options parameters in tomcat9w.exe > Java tab But this is not taken into account

When I google this, it seems we can't set CATALINA_OPTS when starting as a service

Do you have further details on how to set CATALINA_OPTS when starting a service ?

Thank you
Kind regards
Christophe


         

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 17:57
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

Thank you for your answers,

Here below is the output of system part of hs_err file.


Note though If I execute a manual stop and manual start immediately after, this work, no issue.
It is only when I use the Restart option.

Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.

I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
Let me know if you are interested about it.

Thank you
Christophe



---------------  S Y S T E M  ---------------

OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686) OS uptime: 0 days 8:03 hours Hyper-V role detected

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma

Memory: 4k page, system-wide physical 32767M (30013M free) TotalPageFile size 37631M (AvailPageFile size 14413M) current process WorkingSet (physical memory assigned to process): 12M, peak: 12M current process commit charge ("private bytes"): 61M, peak: 20541M

vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916

END.


Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 15:10
To: users@tomcat.apache.org
Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx



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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also 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.

Any help will be appreciated

Thank you
Chris


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


Re: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by Suvendu Sekhar Mondal <su...@gmail.com>.
Hello Christophe,

On Tue, Apr 12, 2022 at 3:56 PM Morfin, Christophe <cm...@ptc.com> wrote:
>
> Hi
>
> As additional information I have done further testing
>
> Windows 2016 32Gb RAM
> Xms/Xmx 20g
> Pagefile 5g
>

Just wondering, how are you setting min and max heap now? By setting
Xms and Xmx values in the Java tab OR by setting values in the
"initial/max memory pool"? If you are using Xms and Xmx values, can
you remove it and try to set heap via "initial/max memory pool"
option? Just wanted to see if that makes any difference or not.

> Service restart works fine
>
> Same configuration on Windows 2019, restart fails with mentioned memory issue.
>
> Windows 2019 8gb RAM
> Xms/Xmx 7g
> Pagefile 2g
> Restart works fine
>
> So it seems to happen only on Windows 2019 with larger heap size.
>

This is indeed interesting. I don't have any Windows 2019 but I'll try with

> Note that this was reported to me by others, so it appears to be easily reproducible .
> I wonder if you would have a chance to test on a Windows 2019 , 64 bit Build 17763 (10.0.17763.2686) with above mentionned configuration as  I feel you would reproduce.
>
> Thank you
> Kind regards
> Christophe
>
>
>
>
>
> -----Original Message-----
> From: Morfin, Christophe
> Sent: 11 April 2022 09:38
> To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
> Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx
>
> Hi Chris
>
> Thank you for the information, this is interesting indeed.
> Yes, I am using the default service installed by Tomcat installer so using procrun and tomcat9.exe
>
> I have tried adding -DCATALINA_OPTS="-Xms20g -Xmx20g" under the Java Options parameters in tomcat9w.exe > Java tab But this is not taken into account
>
> When I google this, it seems we can't set CATALINA_OPTS when starting as a service
>
> Do you have further details on how to set CATALINA_OPTS when starting a service ?
>
> Thank you
> Kind regards
> Christophe
>
>
>
>
> -----Original Message-----
> From: Morfin, Christophe
> Sent: 08 April 2022 17:57
> To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
> Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx
>
> Hi
>
> Thank you for your answers,
>
> Here below is the output of system part of hs_err file.
>
>
> Note though If I execute a manual stop and manual start immediately after, this work, no issue.
> It is only when I use the Restart option.
>
> Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
> When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.
>
> I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
> I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
> Let me know if you are interested about it.
>
> Thank you
> Christophe
>
>
>
> ---------------  S Y S T E M  ---------------
>
> OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686) OS uptime: 0 days 8:03 hours Hyper-V role detected
>
> CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma
>
> Memory: 4k page, system-wide physical 32767M (30013M free) TotalPageFile size 37631M (AvailPageFile size 14413M) current process WorkingSet (physical memory assigned to process): 12M, peak: 12M current process commit charge ("private bytes"): 61M, peak: 20541M
>
> vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916
>
> END.
>
>
> Christophe Morfin
> Principal Technical Support Engineer
>
> 00800 782 4 4357 (00800 PTC 4 HELP)
> cmorfin@ptc.com
>
> thingworx.com
>
>
> -----Original Message-----
> From: Morfin, Christophe
> Sent: 08 April 2022 15:10
> To: users@tomcat.apache.org
> Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx
>
>
>
> 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.
>
> If setting Xms and Xmx to 16Gb, it works.
> If the pagefile size is increased to 32Gb, then it works also 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.
>
> Any help will be appreciated
>
> Thank you
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by "Morfin, Christophe" <cm...@ptc.com>.
Hi

As additional information I have done further testing

Windows 2016 32Gb RAM
Xms/Xmx 20g
Pagefile 5g

Service restart works fine

Same configuration on Windows 2019, restart fails with mentioned memory issue.

Windows 2019 8gb RAM
Xms/Xmx 7g
Pagefile 2g
Restart works fine

So it seems to happen only on Windows 2019 with larger heap size.

Note that this was reported to me by others, so it appears to be easily reproducible .
I wonder if you would have a chance to test on a Windows 2019 , 64 bit Build 17763 (10.0.17763.2686) with above mentionned configuration as  I feel you would reproduce.

Thank you
Kind regards
Christophe



          

-----Original Message-----
From: Morfin, Christophe 
Sent: 11 April 2022 09:38
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi Chris

Thank you for the information, this is interesting indeed.
Yes, I am using the default service installed by Tomcat installer so using procrun and tomcat9.exe

I have tried adding -DCATALINA_OPTS="-Xms20g -Xmx20g" under the Java Options parameters in tomcat9w.exe > Java tab But this is not taken into account

When I google this, it seems we can't set CATALINA_OPTS when starting as a service

Do you have further details on how to set CATALINA_OPTS when starting a service ?

Thank you
Kind regards
Christophe


         

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 17:57
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

Thank you for your answers,

Here below is the output of system part of hs_err file.


Note though If I execute a manual stop and manual start immediately after, this work, no issue.
It is only when I use the Restart option.

Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.

I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
Let me know if you are interested about it.

Thank you
Christophe



---------------  S Y S T E M  ---------------

OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686) OS uptime: 0 days 8:03 hours Hyper-V role detected

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma

Memory: 4k page, system-wide physical 32767M (30013M free) TotalPageFile size 37631M (AvailPageFile size 14413M) current process WorkingSet (physical memory assigned to process): 12M, peak: 12M current process commit charge ("private bytes"): 61M, peak: 20541M

vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916

END.


Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 15:10
To: users@tomcat.apache.org
Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx



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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also 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.

Any help will be appreciated

Thank you
Chris


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


RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by "Morfin, Christophe" <cm...@ptc.com>.
Hi Chris

Thank you for the information, this is interesting indeed.
Yes, I am using the default service installed by Tomcat installer so using procrun and tomcat9.exe

I have tried adding -DCATALINA_OPTS="-Xms20g -Xmx20g" under the Java Options parameters in tomcat9w.exe > Java tab
But this is not taken into account

When I google this, it seems we can't set CATALINA_OPTS when starting as a service

Do you have further details on how to set CATALINA_OPTS when starting a service ?

Thank you
Kind regards
Christophe


         

-----Original Message-----
From: Morfin, Christophe 
Sent: 08 April 2022 17:57
To: 'users@tomcat.apache.org' <us...@tomcat.apache.org>
Subject: RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Hi

Thank you for your answers,

Here below is the output of system part of hs_err file.


Note though If I execute a manual stop and manual start immediately after, this work, no issue.
It is only when I use the Restart option.

Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.

I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
Let me know if you are interested about it.

Thank you
Christophe



---------------  S Y S T E M  ---------------

OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686) OS uptime: 0 days 8:03 hours Hyper-V role detected

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma

Memory: 4k page, system-wide physical 32767M (30013M free) TotalPageFile size 37631M (AvailPageFile size 14413M) current process WorkingSet (physical memory assigned to process): 12M, peak: 12M current process commit charge ("private bytes"): 61M, peak: 20541M

vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916

END.


Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe
Sent: 08 April 2022 15:10
To: users@tomcat.apache.org
Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx



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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also 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.

Any help will be appreciated

Thank you
Chris


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


RE: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by "Morfin, Christophe" <cm...@ptc.com>.
Hi

Thank you for your answers,

Here below is the output of system part of hs_err file.


Note though If I execute a manual stop and manual start immediately after, this work, no issue.
It is only when I use the Restart option.

Both tests are done one after the other, so the overall amount of memory used on the machine at the time is the same in both cases.
When the service stops the committed memory goes down to 2.4 Gb, as nothing else is running on that machine, so there is plenty memory left to restart the process, which indeed happen when we use Stop then Start, but not with Restart.

I have spent some time with Microsoft too as I thought it was due to the OS, but they are telling me it is not and it is related to Tomcat.
I have a process dump that they help me collect. They mentioned it should be helpful to you to check with the symbols.
Let me know if you are interested about it.

Thank you
Christophe



---------------  S Y S T E M  ---------------

OS: Windows Server 2019 , 64 bit Build 17763 (10.0.17763.2686)
OS uptime: 0 days 8:03 hours
Hyper-V role detected

CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 85 stepping 7 microcode 0xffffffff, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, bmi1, bmi2, adx, evex, fma

Memory: 4k page, system-wide physical 32767M (30013M free)
TotalPageFile size 37631M (AvailPageFile size 14413M)
current process WorkingSet (physical memory assigned to process): 12M, peak: 12M
current process commit charge ("private bytes"): 61M, peak: 20541M

vm_info: OpenJDK 64-Bit Server VM (11.0.14+9-LTS) for windows-amd64 JRE (11.0.14+9-LTS), built on Jan 15 2022 01:18:46 by "Administrator" with unknown MS VC++:1916

END.


Christophe Morfin
Principal Technical Support Engineer

00800 782 4 4357 (00800 PTC 4 HELP)
cmorfin@ptc.com

thingworx.com
          

-----Original Message-----
From: Morfin, Christophe 
Sent: 08 April 2022 15:10
To: users@tomcat.apache.org
Subject: Tomcat service does not restart on Windows with high value of Xms/Xmx



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.

If setting Xms and Xmx to 16Gb, it works.
If the pagefile size is increased to 32Gb, then it works also 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.

Any help will be appreciated

Thank you
Chris


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


Re: Tomcat service does not restart on Windows with high value of Xms/Xmx

Posted by Suvendu Sekhar Mondal <su...@gmail.com>.
Hello Christophe,

On Fri, Apr 8, 2022 at 7:40 PM Morfin, Christophe <cm...@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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