United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7144833 sun/tools/jcmd/jcmd-Defaults.sh failing intermittently
JDK-7144833 : sun/tools/jcmd/jcmd-Defaults.sh failing intermittently

Details
Type:
Bug
Submit Date:
2012-02-11
Status:
Resolved
Updated Date:
2013-12-17
Project Name:
JDK
Resolved Date:
2012-02-21
Component:
core-svc
OS:
generic
Sub-Component:
tools
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
This test is failing on some JPRT machines, might be 64-bit only. The following are two examples from linux-x64 and solaris-sparcv9. It's not obvious from the output what is going on so it may be benefical to include more output in the test.

--------------------------------------------------
TEST: sun/tools/jcmd/jcmd-Defaults.sh
JDK under test: (/tmp/jprt/P1/124459.albatem/testproduct/linux_x64_2.6-product)
java version "1.8.0-internal"
Java(TM) SE Runtime Environment (build 1.8.0-internal-201202111244.albatem.tl-b00)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b14, mixed mode)

ACTION: shell -- Failed. Execution failed: exit code 1
REASON: User specified action: run shell jcmd-Defaults.sh 
TIME:   1.093 seconds
messages:
command: shell jcmd-Defaults.sh []
reason: User specified action: run shell jcmd-Defaults.sh 
elapsed time (seconds): 1.093
STDOUT:
14153 com.sun.javatest.regtest.Agent -allowSetSecurityManager -port 57114
19834 com.sun.tools.javac.Main -d /tmp/jprt/P2/124459.albatem/source/jdk/build/linux-amd64/testoutput/jdk_management2/JTwork/classes/sun/management/HotspotRuntimeMBean -classpath /opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/javatest.jar:/opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/jtreg.jar:/tmp/jprt/P2/124459.albatem/source/jdk/build/linux-amd64/testoutput/jdk_management2/JTwork/classes/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product/lib/tools.jar -sourcepath /tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product/lib/tools.jar /tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java
11145 /opt/jprt/dist/jprt.jar startclient -instancename P2
14020 /opt/jprt/products/P1/jtreg4.1-latest/jtreg/lib/jtreg.jar -agentvm -server -Duser.home=/tmp/jprt/P1/124459.albatem -Djava.io.tmpdir=/tmp/jprt/P1/124459.albatem/io/linux_x64-product-c2-jdk_tools2 -vmoption:-server -vmoption:-Duser.home=/tmp/jprt/P1/124459.albatem -vmoption:-Djava.io.tmpdir=/tmp/jprt/P1/124459.albatem/io/linux_x64-product-c2-jdk_tools2 -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/JTreport -w:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/JTwork -jdk:/tmp/jprt/P1/124459.albatem/testproduct/linux_x64_2.6-product -exclude:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/excludelist.txt com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing closed/tools closed/vm
19852 sun.tools.jcmd.JCmd
14664 /opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/jtreg.jar -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/JTreport -w:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/JTwork -jdk:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product -exclude:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/excludelist.txt -javaoptions:-server -javaoptions:-Duser.home=/tmp/jprt/P2/124459.albatem -javaoptions:-Djava.io.tmpdir=/tmp/jprt/P2/124459.albatem/io/linux_x64-product-c2-jdk_management2 com/sun/jmx com/sun/management sun/management closed/sun/management
10707 /opt/jprt/dist/jprt.jar startclient -instancename P1
14153 com.sun.javatest.regtest.Agent -allowSetSecurityManager -port 57114
19834 com.sun.tools.javac.Main -d /tmp/jprt/P2/124459.albatem/source/jdk/build/linux-amd64/testoutput/jdk_management2/JTwork/classes/sun/management/HotspotRuntimeMBean -classpath /opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/javatest.jar:/opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/jtreg.jar:/tmp/jprt/P2/124459.albatem/source/jdk/build/linux-amd64/testoutput/jdk_management2/JTwork/classes/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product/lib/tools.jar -sourcepath /tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product/lib/tools.jar /tmp/jprt/P2/124459.albatem/source/jdk/test/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java
11145 /opt/jprt/dist/jprt.jar startclient -instancename P2
14020 /opt/jprt/products/P1/jtreg4.1-latest/jtreg/lib/jtreg.jar -agentvm -server -Duser.home=/tmp/jprt/P1/124459.albatem -Djava.io.tmpdir=/tmp/jprt/P1/124459.albatem/io/linux_x64-product-c2-jdk_tools2 -vmoption:-server -vmoption:-Duser.home=/tmp/jprt/P1/124459.albatem -vmoption:-Djava.io.tmpdir=/tmp/jprt/P1/124459.albatem/io/linux_x64-product-c2-jdk_tools2 -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/JTreport -w:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/JTwork -jdk:/tmp/jprt/P1/124459.albatem/testproduct/linux_x64_2.6-product -exclude:/tmp/jprt/P1/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_tools2/excludelist.txt com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing closed/tools closed/vm
19871 sun.tools.jcmd.JCmd -l
14664 /opt/jprt/products/P2/jtreg4.1-latest/jtreg/lib/jtreg.jar -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/JTreport -w:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/JTwork -jdk:/tmp/jprt/P2/124459.albatem/testproduct/linux_x64_2.6-product -exclude:/tmp/jprt/P2/124459.albatem/source/jdk/test/../build/linux-amd64/testoutput/jdk_management2/excludelist.txt -javaoptions:-server -javaoptions:-Duser.home=/tmp/jprt/P2/124459.albatem -javaoptions:-Djava.io.tmpdir=/tmp/jprt/P2/124459.albatem/io/linux_x64-product-c2-jdk_management2 com/sun/jmx com/sun/management sun/management closed/sun/management
10707 /opt/jprt/dist/jprt.jar startclient -instancename P1
STDERR:

TEST RESULT: Failed. Execution failed: exit code 1
--------------------------------------------------


--------------------------------------------------
TEST: sun/tools/jcmd/jcmd-Defaults.sh
JDK under test: (/tmp/jprt/P1/165924.albatem/testproduct/solaris_sparcv9_5.10-product)
java version "1.8.0-internal"
Java(TM) SE Runtime Environment (build 1.8.0-internal-201202111659.albatem.tl-b00)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b14, mixed mode)

ACTION: shell -- Failed. Execution failed: exit code 1
REASON: User specified action: run shell jcmd-Defaults.sh 
TIME:   0.607 seconds
messages:
command: shell jcmd-Defaults.sh []
reason: User specified action: run shell jcmd-Defaults.sh 
elapsed time (seconds): 0.607
STDOUT:
21952 com.sun.javatest.regtest.Agent -allowSetSecurityManager -port 59824
22372 sun.tools.jcmd.JCmd
21948 /opt/jprt/products/P1/jtreg4.1-latest/jtreg/lib/jtreg.jar -agentvm -d64 -server -Duser.home=/tmp/jprt/P1/165924.albatem -Djava.io.tmpdir=/tmp/jprt/P1/165924.albatem/io/solaris_sparcv9-product-c2-jdk_tools2 -vmoption:-d64 -vmoption:-server -vmoption:-Duser.home=/tmp/jprt/P1/165924.albatem -vmoption:-Djava.io.tmpdir=/tmp/jprt/P1/165924.albatem/io/solaris_sparcv9-product-c2-jdk_tools2 -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/JTreport -w:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/JTwork -jdk:/tmp/jprt/P1/165924.albatem/testproduct/solaris_sparcv9_5.10-product -exclude:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/excludelist.txt com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing closed/tools closed/vm
19965 Unpack 4XtA5w5gIKha0vmSyHRuDuEvbTdwvfSOdkfCnbfa9Go.pack testout.jar
5415 /opt/jprt/dist/jprt.jar startclient -instancename P1
21952 com.sun.javatest.regtest.Agent -allowSetSecurityManager -port 59824
21948 /opt/jprt/products/P1/jtreg4.1-latest/jtreg/lib/jtreg.jar -agentvm -d64 -server -Duser.home=/tmp/jprt/P1/165924.albatem -Djava.io.tmpdir=/tmp/jprt/P1/165924.albatem/io/solaris_sparcv9-product-c2-jdk_tools2 -vmoption:-d64 -vmoption:-server -vmoption:-Duser.home=/tmp/jprt/P1/165924.albatem -vmoption:-Djava.io.tmpdir=/tmp/jprt/P1/165924.albatem/io/solaris_sparcv9-product-c2-jdk_tools2 -a -ea -esa -v:fail,error,time -retain:fail,error -ignore:quiet -timeoutFactor:4 -r:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/JTreport -w:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/JTwork -jdk:/tmp/jprt/P1/165924.albatem/testproduct/solaris_sparcv9_5.10-product -exclude:/tmp/jprt/P1/165924.albatem/source/jdk/test/../build/solaris-sparcv9/testoutput/jdk_tools2/excludelist.txt com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing closed/tools closed/vm
22374 sun.tools.jcmd.JCmd -l
19965 Unpack 4XtA5w5gIKha0vmSyHRuDuEvbTdwvfSOdkfCnbfa9Go.pack testout.jar
5415 /opt/jprt/dist/jprt.jar startclient -instancename P1
STDERR:

TEST RESULT: Failed. Execution failed: exit code 1
--------------------------------------------------

                                    

Comments
EVALUATION

The problem occurs when one or several lines printed by the jcmd tool match several rules in the awk script checking the output. The counter counting the number of lines matching the expected pattern is incremented each time the line matches a rule. If the line matches several rules, the counter is incremented several times. When it occurs, the test at the end of the script checking that the number
of lines matching the pattern is equal to the number of lines of the output fails.

Here's a modified script fixing the problem:

#
BEGIN	{
    totallines=0; matched=0; current=0;
	}

# match on a main class name followed by arbitrary arguments
/^[0-9]+ [a-z|A-Z][a-z|A-Z|0-9|\.]*($| .*$)/	{
    print("Match");
	    current = 1;
	}

#or match on a path name to a jar file followed by arbitraty arguments
# - note, jar files ending with ".jar" is only a convention, not a requirement.
#Theoretically, any valid file name could occur here.
/^[0-9]+ .*\.jar($| .*$)/	{
    print("Match");
	   current = 1;
}

# or match on the condition that the class name is not available
/^[0-9]+ -- process information unavailable$/	{
    print("Match");
	    current = 1;
	}

	{ totallines++; matched+=current; current=0; print $0 }

END	{
	    if ((totallines > 0) && (matched >= totallines)) {
	        exit 0
	    }
	    else {
	        exit 1
	    }
	}
                                     
2012-02-13



Hardware and Software, Engineered to Work Together