Skip to content

JProfiler is able to find JVM process for one user but can find it for another user on the same machine

I have an ec2-instance with two different users, ec2-user and other-user and I have some jvm processes running on each. I am trying to remote connect via JProfiler but I cannot seem to be able to find the JVM processes in JProfiler (version 12.0.3 Build 12084)

So I started digging into the box to check whats happening, here is what i found

cd /tmp
pwd
drwxr-xr-x 2 other-user   users    4.0K Jul  7 23:35 hsperfdata_other-user
drwxr-xr-x 2 ec2-user   users    4.0K Jul  7 23:35 hsperfdata_ec2-user
ls /tmp/hsperfdata_ec2-user (Nothing)
ls /tmp/hsperfdata_other-user
9014

9014 here is the pid of the java process and the file contains some binary data. However there is another java process run as ec2-user, but that is not showing up in /tmp/hsperfdata_ec2-user.

The two JVMs only differ in the version they are started with

The one that is for the java process run as ec2-user

openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM (build 11.0.11+9-LTS, mixed mode)

The other one for the other-user

openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

I ran ps aux |grep java and found both pids functioning.

I tried to delete the directory, restart the jvm process for ec2-user and then try to attach it again but that did not work.

I also tried to use a different version of JProfiler locally like this on the ec2-instance

wget --no-check-certificate https://download-gcdn.ej-technologies.com/jprofiler/jprofiler_linux_11_0.tar.gz -P /tmp/;tar -zxvf /tmp/jprofiler_linux_11_0.tar.gz -C /tmp

sudo -u ec2-user /tmp/jprofiler11.0/bin/jpenable
No unprofiled JVMs found.

If the target JVM is running as a different user, restart as
    sudo -u [user] jpenable

I am at a loss at how to progress. I was scrounging around for logs for JProfiler remote agent but so far have not found anything. I thought it was a permissions issue on the directories but they seem to be fine. I was checking the release logs but nothing stood out.

Can someone please help me with this?

Answer

Figured it out. I had this jvm arg enabled in the other process

<jvmarg value="-XX:+PerfDisableSharedMem"/>

Once I removed this flag, it was all smooth sailing.