https://bz.apache.org/bugzilla/show_bug.cgi?id=63922

            Bug ID: 63922
           Summary: The Native Memory Tracking cannot be activated by
                    Tomcat 7, 8 or 9 windows service
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Packaging
          Assignee: dev@tomcat.apache.org
          Reporter: artur.linh...@algites.eu
  Target Milestone: -----

In the case the user specifies some from the the NativeMemoryTracking
parameters (see
https://docs.oracle.com/en/java/javase/11/vm/native-memory-tracking.html#GUID-0DB3B8D1-8D7D-447F-B6FF-15620103EE47
) like 

-XX:NativeMemoryTracking=summary

in Windows service registry, restarts the service, so the option can be seen in
the log file by the startup options, then teh Native memory tracking is still
disabled and does not work. If you try with

jcmd <pid> VM.native_memory summary

to get the information about the native JVM memory in the tomcats JVM, the jcmd
call fails with the message

<pid>:
Native memory tracking is not enabled

and in the Tomcat's log file can be found following error message:

Java HotSpot(TM) 64-Bit Server VM warning: Native Memory Tracking did not setup
properly, using wrong launcher? 

The problem seems to be in the JVM launcher Procrun, which dies not initialize
the JVM propertly - as far as I have understood from this blog:

https://blogs.oracle.com/poonam/using-nmt-with-custom-jvm-launcher

The Procrun.exe has to define some environmetn variable before the start of
JVM, etc. to get the native memory tracking to work.

Known workaround is the start of Tomcat from the command line, but this is no
option in the productive environment, where you have to let the service run for
longer time to collect the proper result and maybe also as some different user
because of security concerns, then such option is simply out of possible
scenarios. So the Tomcat service JVM cannot be in such circumstances tracked by
NMT at all, what is the problem in the mission-critical applications.

The Procrun should be modified in the way it enables the NMT in the windows
service by the startup, by setting the environment variable 
NMT_LEVEL_<pid> to the value "detail" or "summary" (or "off" if unspecified) in
the dependency on the specified or unspecified option of 
-XX:NativeMemoryTracking
like done normally by java.exe
Remark: Also change of the startup mode from "jvm" to "exe" or "java" does not
help,. then the windows service does not start at all.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to