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

Local ports used by RMI are inherited by subprocesses

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.1
    • 1.1
    • hotspot
    • None
    • 1.1.1
    • x86
    • windows_nt
    • Not verified



      Name: mc57594 Date: 01/23/97


      Local ports used by RMI objects are inherited by
      subprocesses. Any local ports will be kept open by the subprocess, even
      after the server has died. A method invocation on a remote object
      returns an Exception the first time. Subsequent invocations will hang
      because the client has reconnected to the port the subprocess is keeping
      open.

      RMI ports used by the server should not be inherited by subprocesses
      (which may know nothing of the ports, be written in anything but Java,
      etc.).

      Server:
                      .....
      DummyImpl dummyObj = new DummyImpl();
      Naming.rebind("//:2005/DummyServer", dummyObj);
                      Process subproc = Runtime.getRuntime.exec("cmd /c java
      java.subproc");

                      // java.subproc will now have an open local port it
      knows nothing about.

      subproc:
                      .......
                      // We want to remove the server before invoking the
      donothing() method
                      // so we can see the bug.
                      // The first donothing() after the server has died will
      return an Exception,
                      // the second call will hang while trying to create a
      new connection. If this
                      // process is run standalone, all calls will return
      Exceptions: the first will
                      // be the same, subsequent calls will report a
      ConnectException - no
                      // process is listening to the port.
                      dummyServer = (Dummy)
      Naming.lookup("//:2005/DummyServer");
                      while (true) {
                          try {
                                System.out.println("Kill parent, and hit a key
      to continue");
                                System.in.read();
                                dummyServer.donothing();
                          }
                          catch (Exception e) {
                                System.out.println("DummyClient: an exception
      occurred:");
                                e.printStackTrace();
                          }
                     }
      ======================================================================

            never Tom Rodriguez
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: