JDK-4027711 : Local ports used by RMI are inherited by subprocesses
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-01-23
  • Updated: 1997-10-23
  • Resolved: 1997-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.1.1 1.1.1Fixed
Related Reports
Relates :  
Description

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();
                    }
               }
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: 1.1.1 INTEGRATED IN: 1.1.1
14-06-2004

WORK AROUND Name: mc57594 Date: 01/23/97 None ======================================================================
11-06-2004

PUBLIC COMMENTS File descriptors are inherited by subprocesses.
10-06-2004

EVALUATION Ann Wollrath 1/24/97: The normal behavior for exec on Solaris is for the child process to inherit all the fds of the parent. However, there is no way to get at these fds (except for stdin, stdout, and stderr). All fds except for stdin, stdout, and stderr should be closed on exec. This requires setting the close-on-exec flag for all fds except 0, 1, and 2. This was fixed in 1.1.1. See also bug 4034808. The solution was to close all file descriptors before calling exec. tom.rodriguez@Eng 1997-07-22
22-07-1997