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

Linux: Socket can't be created because of interrupted system call

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0
    • hotspot
    • x86
    • linux



      Name: skR10017 Date: 07/04/2000



      The following test creates consequently groups of 200 threads. Every thread
      creates a socket and connects it to echo port of Solaris machine.
      ( name of Solaris machine is specified in the first argument )
      If connection is successful thread closes socket and exits.

      only under Linux Classic VM (build 1.3.0beta-b09, green threads, nojit)
      Interrupted system call for fd exception is thrown.

      The following tests from Networking testsuite fail due to this reason:
      HttpConnTokenDefTest
      HttpContinueRecvTest
      HttpHostHeaderTest
      HalfCanReadInput
      HalfCanWriteOutput
      HalfNoGetInput
      HalfNoGetOutput
      HalfNoReadInput
      HalfNoReadInput2
      HalfNoWriteOutput
      HalfWriteIgnored
      tcpClient
      ------------------------test.java-----------------------------
      import java.io.*;
      import java.net.*;
      import java.util.*;

      public class test implements Runnable
      {
          int id;
          static String host;

          public test(int iden)
          {
              id=iden;
          }
          public static void main(String[] args) {
              if(args.length==0)
              {
                  System.out.println("Usage: java test hostname");
                  System.exit(0);
              }
              host=args[0];
              int i=0;
              while(i<10000)
              {
                  i++;
                  try {
                      ThreadGroup group = new ThreadGroup("aa");
                      for(int j=0;j<200;j++)
                      {
                          Thread t = new Thread(group, new test(i));
                          t.start();
                          i++;
                      }
                      System.out.print(".");
                      while(group.activeCount()>0)
                      {
                          try {
                              Thread.sleep(10);
                          } catch (InterruptedException e) {
                          }
                      }
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }
          }
          public void run() {
              Socket echo = null;
              try {

                  while (true)
                  {
                      try {
                          echo = new Socket(host, 7);
                          break;
                      } catch (Exception e) {
                          System.out.println("\nOpening:"+id+"\n"+e);
                          System.exit(1);
                      }
                  }

              }
              finally {
                  try {
                      if (echo != null) echo.close();
                  } catch (IOException e) {
                      System.out.println("\nClosing:"+id+"\n"+e);
                      System.exit(1);
                  }
              }
          }
      }
      -----------------------output---------------------------------
      [kotl@linux-5 net]$ java -classic test
      Usage: java test hostname
      [kotl@linux-5 net]$ java -classic test novo48
      .
      Opening:75
      java.net.SocketException: errno: 4, error: Interrupted system call for fd: 84
      [kotl@linux-5 net]$ java -hotspot test novo48
      ..................................................
      [kotl@linux-5 net]$

      novo48 is name of Solaris machine ( Ultra 1 Creator ) which is used
      with the tested Linux machine.
      To reproduce the bug please try to use similar Solaris machine.
      Bug is reproduceable on all our Linux testing platforms.
      The number of thread when the error occurs can depend on
      hardware,OS version and number of opened sockets.
      It is possible that you will need to increase number of threads (10000) to reproduce the bug.
      Please be patient to wait for the failure.
      ( Normal is to wait about 5 minutes )
      --------------------------------------------------------------

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

            Unassigned Unassigned
            kotlsunw Kotl Kotl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: