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();
}
}
======================================================================
- relates to
-
JDK-4153564 Win32 Runtime.exec() inherits fds; Solaris Runtime.exec() doesn't
-
- Closed
-