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

No file descriptors --> java.lang.NoClassDefFoundError when out of file descript

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_2.5

      Description

      When too many FileInputStreams are created, runtime aborts with the
      message "java.lang.NoClassDefFoundError". (Incidentally, since File.close()
      is called from File.finalize(), IMHO it would be a Good Thing to have
      File's constructor do a GC before giving up if there aren't enough file
      descriptors, but that's tangential to this bug).

      This bug can be triggerd by the following code:

      public class foo {
       
          public static void main(String args[]) {
              try {
                  for (int i = 0; i < 1000; i++) {
                      java.io.FileInputStream s
                              = new java.io.FileInputStream("/etc/passwd");
                  }
              } catch (Exception ex) {
                  System.out.println(ex);
              }
              System.out.println("Normal exit");
          }
      }

      Running it produces:
          (env.n) billf@jovial:~/tmp$ java foo
          java.lang.NoClassDefFoundError

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mr Mark Reinhold
              Reporter:
              bfootesunw Bill Foote (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: