# HG changeset patch # User cjplummer # Date 1535598833 25200 # Node ID d395677d99f320f2184966955bd46aa32ff99627 # Parent ad2224d4f34655400aca24d9b06794d439016cde 8199811: com/sun/jdi/ProcessAttachTest.java fails intermittently: Remote thread failed for unknown reason Summary: give attach listener thread a chance to finish starting Reviewed-by: dholmes, gadams diff -r ad2224d4f346 -r d395677d99f3 src/hotspot/os/solaris/attachListener_solaris.cpp --- a/src/hotspot/os/solaris/attachListener_solaris.cpp Tue Aug 28 08:06:59 2018 -0400 +++ b/src/hotspot/os/solaris/attachListener_solaris.cpp Wed Aug 29 20:13:53 2018 -0700 @@ -294,12 +294,17 @@ int return_fd = -1; SolarisAttachOperation* op = NULL; - // no listener + // wait up to 10 seconds for listener to be up and running jint res = 0; - if (!AttachListener::is_initialized()) { - // how did we get here? - debug_only(warning("door_call when not enabled")); - res = (jint)SolarisAttachListener::ATTACH_ERROR_INTERNAL; + int sleep_count = 0; + while (!AttachListener::is_initialized()) { + sleep(1); // 1 second + sleep_count++; + if (sleep_count > 10) { // try for 10 seconds + debug_only(warning("door_call when not enabled")); + res = (jint)SolarisAttachListener::ATTACH_ERROR_INTERNAL; + break; + } } // check client credentials diff -r ad2224d4f346 -r d395677d99f3 src/hotspot/os/windows/attachListener_windows.cpp --- a/src/hotspot/os/windows/attachListener_windows.cpp Tue Aug 28 08:06:59 2018 -0400 +++ b/src/hotspot/os/windows/attachListener_windows.cpp Wed Aug 29 20:13:53 2018 -0700 @@ -184,9 +184,14 @@ // Also we need to be careful not to execute anything that results in more than a 4k stack. // int Win32AttachListener::enqueue(char* cmd, char* arg0, char* arg1, char* arg2, char* pipename) { - // listener not running - if (!AttachListener::is_initialized()) { - return ATTACH_ERROR_DISABLED; + // wait up to 10 seconds for listener to be up and running + int sleep_count = 0; + while (!AttachListener::is_initialized()) { + Sleep(1000); // 1 second + sleep_count++; + if (sleep_count > 10) { // try for 10 seconds + return ATTACH_ERROR_DISABLED; + } } // check that all paramteres to the operation