Sometimes thread does not die automatically

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P5
    • None
    • Affects Version/s: 1.2.0
    • Component/s: core-libs
    • sparc
    • solaris_2.6

      Run the following programs.
      Sometimes parent process(thread) does not die automatically.
      When THREADS_FLAG is set to "native", thread dies automatically.
      But if this environment variable has not been set or set to "green",
      thread does not die automatically.
      - compile ArgPass.java
      - compile Hello.java
      - run this program as follows:
      java ArgPass java Hello

      programs:
      --------------------
      import java.io.*;

      public class ArgPass implements Runnable {
        InputStream is;
        OutputStream os;

        public static void main(String args[]) throws InterruptedException, IOException {
          Process ps = Runtime.getRuntime().exec(args);


          Thread tout = new Thread(new ArgPass(ps.getInputStream(), System.out));
          Thread terr = new Thread(new ArgPass(ps.getErrorStream(), System.err));
          tout.start();
          terr.start();
          tout.join();
          terr.join();

        }

        ArgPass(InputStream is, OutputStream os) {
          this.is = is;
          this.os = os;
        }

        public void run() {
          try {
            int ch;

            while((ch = is.read()) != -1)
              os.write(ch);
          } catch(IOException e) {
          }
        }
      }
      --------------------
      public class Hello {
      public static void main(String args[]) {
      System.out.println("Hello World");
      }
      }
      --------------------

            Assignee:
            Josh Bloch (Inactive)
            Reporter:
            Etsuko Ishida (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: