RFR: 8046883 com/sun/jdi/ProcessAttachTest.sh gets "java.io.IOException: Invalid process identifier" on windows

Staffan Larsen staffan.larsen at oracle.com
Tue Jun 17 12:38:20 UTC 2014


On 17 jun 2014, at 11:56, Dmitry Samersoff <dmitry.samersoff at oracle.com> wrote:

> Staffan,
> 
> As we need windows pid it might be better to try native windows commands
> instead of cygwin ps:
> 
> tasklist

I tried this, but since it does not list the command line it’s not possible to identify the process I am looking for.

> wmic process get Processid,Executablepath

I didn’t know about wmic. It seems usable for this. Something like:

  pid=`wmic process get ProcessId,CommandLine /TRANSLATE:NoComma /FORMAT:csv | grep "cookie=$$" | cut -d "," -f 3`
  
seems to work. On the other hand, if the real problem is that the actual process has not yet been launched (even if bash returns with a cygwin process id) it won’t help whatever command I run - there is no process to list.

/Staffan

> 
> -Dmitry
> 
> 
> On 2014-06-17 12:24, Staffan Larsen wrote:
>> This is yet another fallout of the bug in the ps command in cygwin that causes it to sometimes miss process in the list.
>> 
>> In this case I cannot use jps to list the processes since one of the test cases launches jdwp with suspend=y which suspends the VM before it is visible to jps. Instead I retry the ps command 10 times hoping that it works eventually.
>> 
>> webrev: http://cr.openjdk.java.net/~sla/8046883/webrev.00/test/com/sun/jdi/ProcessAttachTest.sh.sdiff.html
>> bug: https://bugs.openjdk.java.net/browse/JDK-8046883
>> 
>> Thanks,
>> /Staffan
>> 
> 
> 
> -- 
> Dmitry Samersoff
> Oracle Java development team, Saint Petersburg, Russia
> * I would love to change the world, but they won't give me the sources.



More information about the serviceability-dev mailing list