jstack -l vs. systemd service with PrivateTmp set

256 views Asked by At

I run a Tomcat instance as a systemd service. For increased security, I've set PrivateTmp=true.

The manual (see link above) says:

This is useful to secure access to temporary files of the process, but makes sharing between processes via /tmp/ or /var/tmp/ impossible.

Can I still use jstack from the OpenJDK distribution to get a thread dump in any way?

Invoking it the usual way yields the following error message

[PID]: Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding

I guess this is due to the following files / socket

/tmp/hsperfdata_*
/tmp/.java_pid*

being stored under the Tomcat service private tmp sub folder created by systemd dynamically, e.g. /tmp/systemd-private-12c09ea37f57037c11e53e634171a9bb-mytomcat.service-2Hq3RF/:

Can I manually point jstack to the correct tmp sub directory? Maybe by some environment variable or command line parameter?

0

There are 0 answers