RFR(9): 8177092: [TESTBUG] JMX test on MinimalVM fails after fix for 8176533

Robbin Ehn robbin.ehn at oracle.com
Tue Mar 21 09:19:08 UTC 2017


Hi David, thanks for looking at this!

On 03/21/2017 02:32 AM, David Holmes wrote:
> Hi Robbin,
>
> The approach seems reasonable, but my concern is that you may get a false match if there is some java process running that happens to have a numeric argument that matches
> the target PID, or perhaps more likely (though still remote) your target PID is a small number and then becomes a substring of another PID.

Since I never even see even 3-digits pid, it kinda slip my mind.

>
> Can you actually parse the list and check the PID value for an exact match? Or perhaps simply use shouldNotMatch with a pattern that only matches an exact numeric value at
> the start of a line?

Yes of course!

/Robbin

diff -r 03f4b62f3562 test/runtime/MinimalVM/JMX.java
--- a/test/runtime/MinimalVM/JMX.java	Wed Mar 15 18:18:04 2017 -0700
+++ b/test/runtime/MinimalVM/JMX.java	Tue Mar 21 10:11:47 2017 +0100
@@ -49,6 +49,5 @@

-        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), Long.toString(ProcessTools.getProcessId()), "VM.print_threads"});
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), "-l"});
          new OutputAnalyzer(pb.start())
-                .shouldContain("Could not find any processes matching ")
-                .shouldHaveExitValue(1);
+                .shouldNotContain("^" +Long.toString(ProcessTools.getProcessId()) + "\\s+.*$");
      }



>
> Thanks,
> David
>
> On 21/03/2017 12:40 AM, Robbin Ehn wrote:
>> Hi all, please review,
>>
>> 8156537 added a verification that <pid> was an attachable VM.
>> The verification caused a regression because of an underlying bug in an
>> AttachProvider.
>> So the verification was removed for pid case in 8176533.
>> It will be put back when we have fixed: 8176828 (the faulty AttachProvider)
>>
>> This test was written when we had the verification of VM before blasting
>> SIGQUIT and waiting for socket to open.
>> Since we do not verify that the process is suppose to be attachable,
>> jcmd will think that socket should open, which leads to timeout in jcmd
>> for all non-attachable processes.
>>
>> The test is suppose to verify that the minimal VM do not have attach API.
>> I change the test to just list attachable VM's and verify that this
>> minimal VM is not among them.
>>
>> Issue: https://bugs.openjdk.java.net/browse/JDK-8177092
>>
>> Tested locally and with rbt.
>>
>> Thanks
>>
>> /Robbin
>>
>> diff -r 03f4b62f3562 test/runtime/MinimalVM/JMX.java
>> --- a/test/runtime/MinimalVM/JMX.java    Wed Mar 15 18:18:04 2017 -0700
>> +++ b/test/runtime/MinimalVM/JMX.java    Mon Mar 20 15:22:44 2017 +0100
>> @@ -49,6 +49,5 @@
>>
>> -        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"),
>> Long.toString(ProcessTools.getProcessId()), "VM.print_threads"});
>> +        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"),
>> "-l"});
>>          new OutputAnalyzer(pb.start())
>> -                .shouldContain("Could not find any processes matching ")
>> -                .shouldHaveExitValue(1);
>> +
>> .shouldNotContain(Long.toString(ProcessTools.getProcessId()));


More information about the hotspot-runtime-dev mailing list