When trying to attach to a running VM via JVMTI functionality (com.sun.tools.attach.VirtualMachine.attachToCurrentVM() the current running virtual machines are listed by looking in the dir <tempdir>/hsperfdata_<user>. This code is in root/j2se/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java:269.
Basically, the property -Djava.io.tmpdir is searched for the hsperfdata-directory.
However, when the vm creates this tempdir, it is created by getting a tempdir from the function os::get_temp_directory() (see for instance root/hotspot/src/os/linux/vm/perfMemory_linux.cpp:144). On windows, this is the system call GetTempDir, which yields the first set of the following environment variables: TMP, TEMP, USERPROFILE and lastly the
windows directory. On linux and solaris, this is hard-coded to /tmp.
To summarize, the JDK looks for this file in a different place than it's created.
The consequence for us is that our attach-tests fails when we set the -Djava.io.tmpdir in our testing frameworks. This is crucial, because we want to get control over any temp files crated by tests so that we can remove them easily from the machines in the lab when the tests are done.
This looks like a duplicate of http://monaco.sfbay.sun.com/detail.jsf?cr=6938627 that was fixed in 6u23. Can we close this bug?