Name: dkR10031 Date: 06/13/2003
Current implementation of Java Code Coverage Tool
does not shutdown used socket before the end of execution.
To reproduce the bug please try to execute the following
class with Jcov JVMPI agent '-server_port' option:
------------ Source Begin --------------------
public class Hello extends Thread {
public static void main(String[] args) {
try {
sleep(2000);
} catch(InterruptedException ie) {
}
System.out.println("Hello world!");
}
}
------------ Source End ----------------------
------------ Script Begin --------------------
#!/usr/bin/ksh
uname -a
export JCOV_JAR=/net/linux-11/export/home/gary/QA.JCOV/ws/image/lib/jcov.jar
export CLASSPATH=${JCOV_JAR}:.
export TESTED_PORT=10004
export JDK=/net/linux-11/export/home/jdk1.4.1/solaris-sparc
$JDK/bin/java -showversion -Xrunjcov:sp=$TESTED_PORT Hello &
$JDK/bin/java -showversion com.sun.tdk.jcov.grabber.Main -once -port=${TESTED_PORT}
sleep 5
$JDK/bin/java -showversion -Xrunjcov:sp=$TESTED_PORT Hello &
$JDK/bin/java -showversion com.sun.tdk.jcov.grabber.Main -once -port=${TESTED_PORT}
sleep 5
netstat -a|grep $TESTED_PORT
echo 'End of test'
------------ Script End ----------------------
------------ Output Begin --------------------
SunOS novo148 5.8 Generic_108528-20 sun4u sparc SUNW,Ultra-80
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
Hello world!
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
*** JCOV: bind() error : Address already in use
*** JCOV error : could not bind socket to port 10004, I/O server thread terminated
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
*** Error : Jcov grabber: Connection refused. Exception: java.net.ConnectException: Connection refused
Hello world!
novo148.10004 novo148.34904 32768 0 32768 0
TIME_WAIT
End of test
------------ Output End ----------------------
======================================================================