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

(process) java.lang.Process.destroy() fails to free up file handles.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.0, 1.2.1
    • hotspot
    • x86, sparc
    • solaris_2.6



      Name: tb29552 Date: 11/18/98


      /*

      This is a bug that was evidently introduced in
      JDK 1.2 RC1.

      I have an application that repeatedly invokes a program
      by creating a Process object with the Runtime.exec
      method. The process is destroyed when completed.
      However, since the introduction of JDK 1.2 RC1, this
      only works a few times before a bogus IOException
      occurs. Evidently, system file handles are not getting
      freed up when a Process object is destroyed.

      Here is a test case the demonstrates the problem.
      (By the way, I'm on a Solaris 5.5.1/x86 platform).

      */
      import java.io.IOException;
      class FHT {
          public static void main(String args[]) {
              for (int i = 0; i < 4000; i++) {
                  try {
                      Process p = Runtime.getRuntime().exec("/bin/echo hello");
                      p.destroy();
                  }
                  catch(IOException x) {
                      System.err.println("Bogus IOException after " + i +
                                         " invocations: " + x.getMessage());
                      return;
                  }
              }
          }
      }

      (Review ID: 42890)
      ======================================================================

            collins Gary Collins (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: