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

Linux: LinuxThreads bug in handling SIGCHLD

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1
    • 1.3.0
    • hotspot
    • None
    • ladybird
    • x86
    • linux
    • Verified

        Red hat 6.2, jdk1.3.0 beta refresh downloaded from
        java.sun.com, dated with 07/10/00, native threads mode.

        If one thread creates the process by calling the Runtime.exec() and finish
        after that, then other thread always receives IllegalThreadStateException
          calling the exitValue() for this process object.

        Note: this isn't reproducible in classic mode.

        To reproduce:
        - compile test_pr.java
        - run in native mode
        The program will be forever running.

        [tester@twq-infiniti tmp]$ java -version
        java version "1.3.0beta_refresh"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
        Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)
        [tester@twq-infiniti tmp]$ java test_pr
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited
        checker: Catched the process hasn't exited

        [tester@twq-infiniti tmp]$ java -classic test_pr
        checker: Catched the process hasn't exited
        checker: Exit value is 0
        [tester@twq-infiniti tmp]$

        === test_pr.java


        public class test_pr {

            Process proc = null;

            public static void main(String argv[]) {

        test_pr mon = new test_pr();

        starter st = new starter(mon);
        st.start();

        try {
        Thread.currentThread().sleep(2000);
        } catch (Exception e) {
        System.out.println("main: Interrupted sleep after starter " + e.getMessage());
        System.exit(1);
        }

        checker ck = new checker(mon);
        ck.start();

        while(true) {
        try {
        Thread.currentThread().sleep(2000);
        } catch (Exception e) {
        System.out.println("main: Interrupted sleep " + e.getMessage());
        System.exit(1);
        }
        synchronized(mon){
        mon.notifyAll();
        }

        }
            }

        }



        class starter extends Thread {
            
            test_pr mon;
            
            starter(test_pr mon) {
        this.mon = mon;
            }

            public void run(){
        synchronized(mon) {
        try {
        mon.proc = Runtime.getRuntime().exec("/bin/sleep 6");
        } catch (Exception e) {
        System.out.println("starter: Can't start the process the " + e.getMessage());
        System.exit(1);
        }
        }
            }
        }


        class checker extends Thread {

            test_pr mon;

            checker(test_pr mon) {
        this.mon = mon;
            }

            public void run(){
        while (true) {
        synchronized(mon){
        try {
        mon.wait();
        } catch (Exception e) {
        System.out.println("checker: Interrupted wait " + e.getMessage());
        System.exit(1);
        }
        try {
        int ev = mon.proc.exitValue();
        System.out.println("checker: Exit value is "+ev);
        System.exit(0);
        } catch (IllegalThreadStateException ie) {
        System.out.println("checker: Catched the " + ie.getMessage());
        }
        }
        }
            }
        }


        ================
        viktor.lapitski@eng 2000-08-29

              duke J. Duke
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: