Search code examples
openssltomcat9

Apache Tomcat 9 Subprocess https-openssl-n high CPU usage


Does anyone know what are some reasons of the https-openssl-n long running processes in tomcat. Below is the example output of the tomcat subprocess using command top -n 1 -H -p 422. And does any know if it is safe to use linux kill command to terminate these stuck processes?

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    491 tomcat    20   0 5026072   2.6g  20044 R  73.3  34.4   1363:26 https-openssl-n
    490 tomcat    20   0 5026072   2.6g  20044 R  53.3  34.4   1372:33 https-openssl-n
   3379 tomcat    20   0 5026072   2.6g  20044 R  46.7  34.4   1386:57 https-openssl-n
   3516 tomcat    20   0 5026072   2.6g  20044 R  20.0  34.4   1396:43 https-openssl-n
    422 tomcat    20   0 5026072   2.6g  20044 S   0.0  34.4   0:00.00 java
    426 tomcat    20   0 5026072   2.6g  20044 S   0.0  34.4   0:22.08 java

Solution

  • There was a recursive loop bug in our application. We used jcmd command line tool to export the heap dump for the Tomcat process.

    jcmd <pid> GC.heap_dump <file-path>
    

    Then, we opened the heap dump with Memory Analyzer (MAT) from https://eclipse.dev/mat/ to find the long running process. We were able to locate the recursive thread and make a code change to fix the bug.