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

REGRESSION: Socket timeout to large with setSoTimeout()

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      x86
    • OS:
      generic, windows_nt
    • Verification:
      Verified

      Description



      Name: gm110360 Date: 10/08/2001


      java version "1.4.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
      Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)

      The timeout values are to large. The InterruptedIOException occur to late. It
      is not the values that was set with setSoTimeout().

      public class Test {
        static java.net.ServerSocket ss;
          static void Test_Socket_Timeout(){
              try{
                  ss = new java.net.ServerSocket(20000);
                  (new Thread(){
                      public void run(){
                          try{
                              ss.accept();
                          }catch(Throwable e){e.printStackTrace();}
                      }}).start();
              
                  java.net.Socket socket = new java.net.Socket("LocalHost",20000);
                  socket.setSoTimeout(1);
                  java.io.InputStream in = socket.getInputStream();
                  for(int i=0; i<10; i++){
                      long time = System.currentTimeMillis();
                      try{
                          in.read();
                      }catch(java.io.InterruptedIOException ioex){
                          System.out.println("timeout after:"+
                                             (System.currentTimeMillis()-time));
                      }
                  }
              }catch(Throwable e){
                  e.printStackTrace();
              }
          }
          public static void main(String[] args) {
           Test.Test_Socket_Timeout();
          }
      }

      Results with JDK 1.4 beta2
      timeout after:521
      timeout after:521
      timeout after:521
      timeout after:520
      timeout after:521
      timeout after:521
      timeout after:521
      timeout after:520
      timeout after:521
      timeout after:521

      Results with JDK 1.3
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10
      timeout after:10

      I think this is a not acceptable delay with JDK 1.4.

      Release Regression From : 1.3.1_01
      The above release value was the last known release where this
      bug was knwon to work. Since then there has been a regression.

      (Review ID: 133310)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            alanb Alan Bateman
            Reporter:
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: