Getting "well-known file /tmp/.java_pidxxx is not secure: file's group should be the current group (which is 1xx7) but the group is 1xx8" when executing jstack / jmap / jcmd and unable to generate a thread dump / heap dump

Solution Verified - Updated -

Issue

  • Got the following
    well-known file /tmp/.java_pidxxx is not secure: file's group should be the current group (which is 1xx7) but the group is 1xx8
    when executing jstack command and unable to generate a thread dump:

    [root@myhost /tmp]# jstack -l <JAVA_PID>
    <JAVA_PID>: 
    java.io.IOException: well-known file /tmp/.java_pid<JAVA_PID> is not secure: file's group should be the current group (which is 1xx7) but the group is 1xx8
        at sun.tools.attach.LinuxVirtualMachine.checkPermissions(Native Method)
        at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:117)
        at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
        at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
        at sun.tools.jcmd.JCmd.executeCommandForPid(JCmd.java:147)
        at sun.tools.jcmd.JCmd.main(JCmd.java:131)
    
  • Got the following
    well-known file /tmp/.java_pidxxx is not secure: file's group should be the current group (which is 1xx7) but the group is 1xx8
    when executing jmap command and unable to generate a heap dump:

    [root@myhost /tmp]# jmap -dump:format=b,file=heap.hprof <JAVA_PID>
    <JAVA_PID>:
    java.io.IOException: well-known file /tmp/.java_pid<JAVA_PID> is not secure: file's group should be the current group (which is 1xx7) but the group is 1xx8
        at sun.tools.attach.LinuxVirtualMachine.checkPermissions(Native Method)
        at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:117)
        at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
        at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
        at sun.tools.jcmd.JCmd.executeCommandForPid(JCmd.java:147)
        at sun.tools.jcmd.JCmd.main(JCmd.java:131)
    
  • Same error was thrown when executing jcmd <JAVA_PID> GC.heap_dump -all=true FILENAME.hprof

Environment

  • Red Hat AMQ
    • 7.x
  • Red Hat Enterprise Linux (RHEL)
    • 7.x
  • OpenJDK
    • 1.8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content