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

(process) Process.destroy fails to close in/out/err streams causing IOException

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.4.0
    • core-libs
    • sparc
    • solaris_8

      Bug mentioned below exists for all previous JDK releases and current Merlin release.

      File handles are not getting freed up when a Process object is destroyed.
      User needs to implement a close for each stream. It would be better
      if destroy() method could close all streams for a given process.

      Please see workaround on how to fix testcase to get around file handle issue.
      This needs to be documented for Merlin in some way or fixed in future release.


      Testcase below:

      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;
                   }
               }
           }
      }

      We need to close streams only if we have not given them out.


      ###@###.### 2002-06-24

            Unassigned Unassigned
            collins Gary Collins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: