JDK-5069989 : (process) Runtime.exec unnecessarily inherits open files (win)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-06-30
  • Updated: 2013-05-24
  • Resolved: 2013-05-24
Related Reports
Duplicate :  
Relates :  
Description
Name: js151677			Date: 06/30/2004


A DESCRIPTION OF THE REQUEST :
Process launched from Runtime.exec() unnecessarily inherits open files in Windows 2000 with java 1.4.2.

Look at bug  entries:
4153564 , 4200502 , 4228651 , 4744948



JUSTIFICATION :
Process launched from Runtime.exec() unnecessarily inherits open files in Windows 2000.

This is especially nasty feature with sockets. I'm currenlty trying to achieve following:
 - Java application receives a SOAP request with HTTP 1.0
 - Java application passes the request to JCA adapter, which starts a native program with Runtime.exec(..). (Only when needed)
 - Java application receives the response from native program
 - Java application sends the response to SOAP client and closes the socket. But because the native program
   is still around and has inherited the socket - the socket is still open and the SOAP client does not get
   the socket close event - and doesn't receive the data.

Look at entries:
4153564 , 4200502 , 4228651 , 4744948

In these cases the bug was closed with explanation:

"It appears that we've called CreateProcess with a value
of "TRUE" for inheritance of system handles since at least jdk1.1.8."

I'd like to say: You have has a bug since jdk1.1.8 - and got it reported - and done nothing.

I don't believe anyone is counting on inherited sockets/files. And if I've understood correctly, the open sockets
are not inherited in Unix. Shouldn't these work in a same way in both cases? I think the correct way should be to start the process with createProcess but set the file descriptor inheritance flag off.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
By default don't inherit sockets. If this is needed then add this as an option to new ProcessBuilder class in java 1.5.
(Incident Review ID: 281895) 
======================================================================

Comments
All bugs about unnecessarily inherits joined to JDK-7147084 with R&D result and discussion.
24-05-2013

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
01-10-2004

PUBLIC COMMENTS -
01-10-2004

EVALUATION It is true that (almost) all file descriptors are closed in child processes on Unix. The submitter's argument is persuasive. I hope to be able to actually fix this in Mustang. ###@###.### 2004-07-02
02-07-2004