ADDITIONAL SYSTEM INFORMATION :
$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: AmazonAMI
Description: Amazon Linux AMI release 2018.03
$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Apache Tomcat Version 8.0.42
Tested with JMC v5, v7 and v8 early access.
A DESCRIPTION OF THE PROBLEM :
When running tomcat with a unix user in a folder the user has no write permission in, the default JFR recording doens't seem to collect method profiling data. The corresponding view in JMC is empty.
Potentially related problem: https://stackoverflow.com/questions/38459777/jmc-doesnt-show-hot-methods-and-packages
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- install tomcat as an init service (on my machine $CATALINA_HOME/bin/daemon-mod.sh is symlinked to /etc/init.d/tomcat). This script uses apache jsvc to fork the process and run it with the configurable tomcat user (`tomcat` by default)
- modify tomcat's setenv.sh file and add the `CATALINA_OPTS` for a jmx port and a default recording (-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,disk=true,repository=/tmp,maxage=30s)
- start tomcat `sudo service start tomcat`
- jsvc should have created two process with identical arguments (one run by root, the other by tomcat)
- both processes should run in the root folder `/`
EXPECTED VERSUS ACTUAL BEHAVIOR :
The method profiling window in JMC shows profiling data each time the default recording is reloaded.
In the first minute or so (maybe while jsvc runs in root privileges before forking to the default tomcat user), opening the default recording in JMC shows proper method profiling data in the corresponding view.
After a while, reloading the method profiling data from the inspected process will show an empty method profiling view in JMC.
CUSTOMER SUBMITTED WORKAROUND :
Start tomcat in a folder that the default tomcat user has write permissions in.
FREQUENCY : always