Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-2738

TomEE windows service does not support Java Native Memory Tracking feature

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 7.0.0, 1.7.5, 7.1, 8.0.0-Final
    • None
    • TomEE Core Server
    • None

    Description

      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 the 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 properly - 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 environment 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.

      See also the Tomcat bug
      https://bz.apache.org/bugzilla/show_bug.cgi?id=63922

      See also the bug DAEMON-412.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            goodwin Artur Linhart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: