OK, my last try at this was very broken - I’m glad it didn’t pass the review.
Here is a new try: http://cr.openjdk.java.net/~sla/8029808/webrev.01/ As Alan says, we can’t use jps on the (second) debuggee becuse it is started with suspend=y. In that mode it is waiting for a debugger to attach before it has started executing any Java code and before jps is able to identify it. I did find a race in the test, though. When the first debuggee is started (suspend=n) there is a race where the debugger process can attach and finish before the debuggee has written out the portfile. In that case ShutdownDebuggee will fail. I have seen this failure mode happen and I can force it by inserting a Thread.sleep into the debuggee. I solved this by waiting for the port file to appear in the suspend=n case as well. There is also a potential problem where both debuggees use the same output file and we may think the second debuggee has started before it actually has (because the output file isn’t empty). I solved that be creating different output files for the two test cases. I’ve also redirected all error streams so any errors aren’t lost. Thanks, /Staffan On 30 jan 2014, at 18:09, Alan Bateman <alan.bate...@oracle.com> wrote: > On 30/01/2014 16:59, Dmitry Samersoff wrote: >> Staffan, >> >> No it's not to your code. Sorry for not being clean enough. >> >> You cleaned up unix code, but windows code remains bad. Particularly, it >> has bad unconditional sleep 2 >> >> I would propose replace *windows manipulation with CYGWIN/MKS pids* to >> call to JPS that return windows pid >> > I have a vague memory that we had to use ps to get the pid because of the > suspend=y test which cause the debuggee to suspect during startup. I might be > wrong on this of course, it was a long time ago. > > -Alan