Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4344135

Linux: close is not preemptive

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      rc1
    • CPU:
      generic, unknown, x86
    • OS:
      linux
    • Verification:
      Verified

      Backports

        Description



        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$

        --------------------------------------------------------------


        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                alanb Alan Bateman
                Reporter:
                kotlsunw Kotl Kotl (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: