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

(process spec) Clarify need to invoke Process.destroy

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      generic
    • OS:
      generic

      Description

      A program that creates many subprocesses should invoke Process.destroy in order
      to ensure that all underlying resources are reclaimed. This should be
      mentioned in the spec of the Process class and of the Process.destroy method
      itself.

      -- ###@###.### 2003/1/9

        Issue Links

          Activity

          Hide
          mr Mark Reinhold added a comment -
          BT2:EVALUATION

          Yes. -- ###@###.### 2003/1/9
          Show
          mr Mark Reinhold added a comment - BT2:EVALUATION Yes. -- ###@###.### 2003/1/9
          Hide
          martin Martin Buchholz added a comment -
          BT2:WORK AROUND

          static void closeStreams(Process p) throws IOException {
          p.getInputStream().close();
          p.getOutputStream().close();
          p.getErrorStream().close();
              }

          Process p = ...
          try {...} // use p
          finally { closeStreams(p); p.destroy(); }
          Show
          martin Martin Buchholz added a comment - BT2:WORK AROUND static void closeStreams(Process p) throws IOException { p.getInputStream().close(); p.getOutputStream().close(); p.getErrorStream().close();     } Process p = ... try {...} // use p finally { closeStreams(p); p.destroy(); }
          Hide
          martin Martin Buchholz added a comment -
          BT2:EVALUATION

          See
          6462165: (process) Preach Process file handle hygiene

          for an example of good Process cleanup.

          Yes, we should clarify that the OS-level subprocess may survive the
          garbage collection of the Process object and even the termination of the JVM itself.
          Show
          martin Martin Buchholz added a comment - BT2:EVALUATION See 6462165: (process) Preach Process file handle hygiene for an example of good Process cleanup. Yes, we should clarify that the OS-level subprocess may survive the garbage collection of the Process object and even the termination of the JVM itself.

            People

            • Assignee:
              Unassigned
              Reporter:
              mr Mark Reinhold
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: