On 18/12/2014 11:52, Chris Hegarty wrote:
Thanks for looking at this Alan.

Surprisingly this issue has existed for a long time. I tested with the FCS 
version of JRE 5, 6, 7, 8, and 9-ea, on Windows Server 2008 R2, and 2012, and 
the newly accepted socket inherit behaviour can be seen.  NIO server socket 
channels also suffers from the same problem.

Since networking and NIO already sets HANDLE_FLAG_INHERIT on newly created 
sockets, I’d like to keep it consistent, and set it on accepted sockets too. I 
also think that this fix should be backpored to previous releases, so a small 
localised change seems appropriate.

Complete and updated webrev:
    http://cr.openjdk.java.net/~chegar/8067105/webrev.00/webrev/

I will file a separate bug to investigate why CreateProcess is being called 
with bInheritHandles set to TRUE, as I think any changes here will have a wider 
impact.

I'm very surprised by this because the issue of inheriting handles into child processes has come up several times in the past. The patch you propose is okay but it doesn't deal with the case of a process being started at around the time that a connection is accepted. The only way to deal with this type of race is to never inherit (Dmitry's point about the standard in/out/err should already be dealt with it). So yes, I think it is important to dig into some of the history and to understand whether we regressed somewhere and why we have the flag set this way.

-Alan

Reply via email to