Try to run jcmd <pid> Thread.print under the same user as java process has, otherwise your connections will be dropped. Java doesn’t care if you are root or not.
1
2
sudo-u<java_process_user>jcmd<pid>Thread.print
sudo-ujhipster jcmd6Thread.print
Or use tool:
A more user-friendly way to view threads per process is via htop, an ncurses-based interactive process viewer. This program allows you to monitor individual threads in tree views.
So we need to instll htop.
1
apk add htop
To enable thread views in htop, launch htop, and press F2 to enter htop setup menu. Choose “Display option” under “Setup” column, and toggle on “Tree view” and “Show custom thread names” options. Presss F10 to exit the setup.
And you can sort the thread list by PERCENT CPU:
When trying with jstack, got the error:
jstack: not found
Now the extra OpenJDK with the toolkit is required:
1:Unable toopen socket file:target process notresponding orHotSpot VM notloaded
Root cause:
because PID 1 is special and it doesn’t handle any signal unless explicitly declared. So the workaround is to have the java process spawned at non PID 1. Here comes Tini into play!
If you keep bash as PID 1, you’d no longer get signals from docker stop and docker kill (without having to write traps). With docker 1.13 you can use --init to have docker put in tini as PID 1; it’ll forward signals and reap zombies.
Information:
JVM will generate a directory under /tmp named hsperfdata_$USER($USER is the user name that starts the java process). In this directory, there are PID files, which will store the JVM process information.
Tools like jps、jstack will read the PID files in /tmp/hsperfdata_$USER to get the connection information.
If gets the error:Unable to open socket file. The root cause is that the PID file of the java process has been deleted.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the ...
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.