Markus,
On 12/27/24 12:16 PM, i...@flyingfischer.ch.INVALID wrote:
Manisha
you may be able to disable explicit System.gc() via the java argument -
XX:+DisableExplicitGC.
https://www.baeldung.com/java-system-gc
But ... WHY?
This is a situation that should really only occur once during the
application lifecycle (when it's being shut-down). Typically at
shut-down you really don't care if a GC is going to happen.
Also, tearing-down an application typically generates ... a lot of
garbage. So a GC is likely to happen, anyway, naturally. If your
application is big and there is memory pressure (unlikely, since
everything is coming down) or if the GC sees large de-allocations and
takes an opportunity to tidy-up the heap, then you may even get a FULL
GC when this is all happening.
Finally, it's in there to avoid a JVM crash which is pretty much the
worst thing that can happen to your application, even if it is shutting
down.
-chris
Am 27.12.24 um 17:55 schrieb Christopher Schultz:
Manisha,
On 12/27/24 2:45 AM, Manisha Subramanian wrote:
Details of our application are given below:
OS: RHEL 8.x [OpenSSL version: 1.1.1]
Configuration: We're using Tomcat as an HTTP Server, but it is
embedded as part of our application
Java version: Java 8u381
We're using Apache Tomcat 9.0.86 and are considering an update to
9.0.98. During the update, we noticed this commit, where we saw a
System.gc() call:
Avoid possible crashes with OpenSSL * apache/tomcat@bb4a5a0 *
GitHub<https://github.com/apache/tomcat/commit/
bb4a5a08603d8e1d67b4249fe8c634571a6ec852>.
If we choose to stop our HTTP server [and the JVM chooses to honor
this System.gc() call] it will not just affect Tomcat, but the entire
JVM and may cause issues to our application.
The commit message says it'll occur mostly with the Tomcat test suite
but the impacts of the gc call may affect the entire application.
I would think that taking down Tomcat and/or its connectors (which is
what you would be doing when AprLifecycleListener.terminateAPR is
called) would have a much bigger impact on your application (like
STOPPING it) than requesting garbage-collection (which happens all the
time).
We were wondering why this System.gc() was added. Request you to
share your views.
The gc() call was added to attempt to force the cleanup of resources
that have an impact on native-library resources before terminating the
native library (OpenSSL). It is intended to prevent native crashes
(which typically terminate the JVM) in some edge cases.
-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