On 03/02/2014 19:18, Staffan Larsen wrote:
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.
This update looks okay to me (and good to have found the race).
-Alan.