jps process information unavailable - jconsole and

2019-03-23 18:42发布

问题:

After a windows update, my jps, jconsole et jvisualvm are not working anymore.

Jps gives me the process ids, but it tells me process information unavailable

And I'm unable to connect to those processes with jvisualvm as I used to.

I'm running the 1.6.0_22 jre.

I already had the problem in the past, tries this trick, and it worked. But this time, bad luck, it does not help.

Edit : I found a solution : in my temp folder, I did destroy the hsperfdata_<username> folder. Apparently there was an issue with the case of my username. The folder was called hsperfdata_myname. After having been destroyed and re-created by a call to jps, it was called hasperfdata_MYNAME.

Very strange.

回答1:

In my temp folder, I did destroy the hsperfdata_ folder. Apparently there was an issue with the case of my username. The folder was called hsperfdata_myname. After having been destroyed and re-created by a call to jps, it was called hasperfdata_MYNAME.

Very strange.



回答2:

On unix, make sure you are running as the user that started it.



回答3:

we're having the same problem here.

The tmp folder trick didn't work for us, as well.

So far, we've found a few ways to make things work again:

  • a system restore
  • rename the temp folder under "C:\Documents and Settings\myusername\Local Settings" and create a new temp folder (I'm not sure that this is a safe thing to do, regarding to windows...)
  • start removing stuff from temp folder manually
  • probably the safest: run ccleaner, this will clean up the temp folder


回答4:

I wrote a script to apply the work-around, which I call from some of my monitoring scripts, until this is fixed.

#!/bin/bash
# Name: fix_jps.bash
# Author: Cameron Pierce
#
# Purpose: create /tmp/hsperfdata directories that jps and jstat can work with

## VARIABLES
RETVAL=""
fileHSP=""
filePID=""
fileLOG=/tmp/fix_jps.log

# for every /tmp/hsperfdata_[name] directory that exists
for fileHSP in `ls -d /tmp/hsperfdata_*`; do
        #echo "entry ${fileHSP}" # DEBUG
        # if our search returns entries that are not directories, skip them
        if [ ! -d ${fileHSP} ]; then
                continue
        fi
        #ls ${fileHSP} # DEBUG

        # alternative to ls below
        #FINDFILES=(${fileHSP}/*)
        #if [ ${#FINDFILES[@]} -gt 0 ]; then
        #       echo "files in $fileHSP: ${#FINDFILES[@]} "
        #fi
    for filePID in `ls ${fileHSP}/ 2>> ${fileLOG} | grep "[[:digit:]]\{1,\}"`; do
            #echo "pid name: ${filePID}" # DEBUG
            # if the directory was empty, move on to the next fileENTRY
            if [ "${filePID}" == "" ]; then
                    #echo "the contents of the variable filePID appear to be empty \"${filePID}\"" # DEBUG
                    # remove the fileHSP if empty; this will clean up user hsperfdata dirs
                    rmdir ${fileHSP} 2>> ${fileLOG}
                    continue
            # if a symlink already exists, move on to the next fileENTRY
            elif [ -h /tmp/hsperfdata_${filePID} ]; then
                    #echo "symlink already exists for /tmp/hsperfdata_${filePID}" # DEBUG
                    continue
            fi
            #echo "name: ${filePID}"
            # if a process exists for filePID, create a symlink to the source file
            ps -eo pid | awk '{print $1}' | grep -q "^${filePID}$"
            RETVAL=$?
            # if a process exists with pid of filePID and a symlink doesn't exists, create symlink
            if [ $RETVAL -eq 0 -a ! -e /tmp/hsperfdata_${filePID} ]; then
                    ln -s ${fileHSP}/${filePID} /tmp/hsperfdata_$filePID
                    #echo ls -l /tmp/hs perfdata_${filePID} # DEBUG
            fi
    done
done

# remove broken symlinks
#find -L /tmp/hsperfdata_* -type l # DEBUG
find -L /tmp/hsperfdata_* -type l -delete


标签: java jconsole