Java jstack insufficient memory tool or insufficient privilege to attach

I'm really confused: In my windows 2008r2 I have a windows service, this is actually a java progress, running as a SYSTEM user. Now I use Jstack for the service. But an error occurs:

insufficient memory or insufficient privilege to attach 

But if I use the Jstack -F options, it can work for sure. I am considering a jdk source, it uses the BugSpotAgent class to complete the above.

I want to know the main reason why I cannot use Jstack , is this a SYSTEM problem for the user? I am also trying to use PsExec.exe (tool) to start my Jstack (this means that I will use SYSTEM to start Jstack ), but it still cannot work.

Can you help me?

Thank you and respectfully!

+6
source share
1 answer

jstack can only click on a process starting with the same user in the same session . When no session is specified, the psexec command is delayed in the console session and throws this error when trying to get a stream dump.

the solution is to ensure that the user and session used with psexec are the same as for the target Java process.

if it was started by a regular user as well. use the same user credentials to log in without the -s or -h sign b. find the identifier of the session in which the process was started. (You can find it using the task manager and go to the "Users" tab). Use this session identifier with the -i flag

psexec \\server-name -u username -p password -i session-id command

eg.

psexec \\192.168.1.1 -u john -p pass123 -i 1 jstack.exe 4242

Note. If the java process was started by the user SYSTEM, use the -s flag

+4
source

Source: https://habr.com/ru/post/958654/


All Articles