Manisha

you may be able to disable explicit System.gc() via the java argument -XX:+DisableExplicitGC.

https://www.baeldung.com/java-system-gc

Markus


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

Reply via email to