# HG changeset patch # User ctornqvi # Date 1476785830 14400 # Node ID cfcaf7b4d7ac78f7e7cf39474499a2c462449473 # Parent 93c64aa0b62f40c5b25eebb4911071c6c9ea0ef3 8159799: Tests using jcmd fails intermittently with Could not open PerfMemory on Windows Reviewed-by: gtriantafill, dholmes, sla, fparain diff -r 93c64aa0b62f -r cfcaf7b4d7ac hotspot/src/os/windows/vm/perfMemory_windows.cpp --- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp Tue Oct 18 06:14:10 2016 -0400 +++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp Tue Oct 18 06:17:10 2016 -0400 @@ -1404,12 +1404,14 @@ objectname); /* name for object */ if (fmh == NULL) { + DWORD lasterror = GetLastError(); if (PrintMiscellaneous && Verbose) { warning("OpenFileMapping failed for shared memory object %s:" - " lasterror = %d\n", objectname, GetLastError()); + " lasterror = %d\n", objectname, lasterror); } - THROW_MSG_(vmSymbols::java_lang_Exception(), - "Could not open PerfMemory", INVALID_HANDLE_VALUE); + THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), + err_msg("Could not open PerfMemory, error %d", lasterror), + INVALID_HANDLE_VALUE); } return fmh;;