Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2034687 | 1.4.0 | Alan Bateman | P3 | Resolved | Fixed | beta3 |
Name: skR10017 Date: 06/08/2000
Test engr/net/UDPCloseTest from testbase_js suite fails due to the following reason:
The following test creates DatagramSocket and waits for data in the
child Thread ( setSoTimeout is set to 30 seconds).
Parent thread waits 4 seconds and closes the socket.
Test assumes that Socket closed exception should be thrown immediately after the socket
is closed but under
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b07)
Java HotSpot(TM) Client VM (build 1.3.0beta-b04, mixed mode)
and
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b07)
Java HotSpot(TM) Server VM (build 1.3.0beta-b04, mixed mode)
Socket closed exception is thrown only when setSoTimeout period is expired.
Delay between socket is closed and exception is thrown is printed
to stdout. It should be about 4000 ( 4 seconds ).
This bug affects only client and server VM for linux.
Under classic VM this test passes.
--------------------------test.java-----------------
import java.net.*;
import java.io.*;
public class test extends Thread {
public static DatagramPacket p;
public static DatagramSocket s;
public static void main (String[] a) {
try {
s = new DatagramSocket();
byte[] recvbuf = new byte[200];
p = new DatagramPacket(recvbuf, 200);
Recv r = new Recv();
(new Thread(r, "DGRecv thread#")).start();
Thread.sleep(4000); // relinquish CPU for green threads....
s.close();
Thread.yield(); // relinquish green CPU...
} catch (Exception e) { }
}
}
class Recv extends Thread {
public void run() {
long start = System.currentTimeMillis();
try {
test.s.setSoTimeout(30000);
test.s.receive(test.p);
} catch (IOException e) {
System.out.println("Exception: "+e);
long delta = System.currentTimeMillis() - start;
System.out.println("Delta="+delta);
}
}
}
-----------------------output------------------------------
Linux:
[kotl@linux-4 b]$ java -version
java version "1.3.0beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b07)
Java HotSpot(TM) Client VM (build 1.3.0beta-b04, mixed mode)
[kotl@linux-4 b]$ java test
Exception: java.net.SocketException: socket closed
Delta=30007
[kotl@linux-4 b]$
Solaris:
bash-2.00$ java -version
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, interpreted mode)
bash-2.00$ java test
Exception: java.net.SocketException: socket closed
Delta=4009
bash-2.00$
--------------------------------------------------------------
======================================================================
- backported by
-
JDK-2034687 Linux: close is not preemptive
- Resolved
- duplicates
-
JDK-4435342 Linux: Volano chatroom server hang upon shutdown
- Closed
-
JDK-4504764 Socket.read() doesn't return when Socket.close() is called under Linux
- Closed
-
JDK-4386498 ServerSocket.accept does not detect interrup or close
- Closed
-
JDK-4482812 Socket.close() doesn't work with jdk1.3.1/Linux2.4.[25]
- Closed
-
JDK-4755503 thread are blocked on the socket.accept()(ServerSocket class) method
- Closed
-
JDK-4392428 TCP connections not closing
- Closed