On Tue, Oct 22, 2013 at 3:53 PM, Matt <[email protected]> wrote:
> I think this is a bug in node, but want to be sure before posting to the
> issue tracker.
>
> It seems that when spawning a child process while in a cluster worker, the
> child process inherits the worker's filehandles, no matter what you pass as
> options to child_process.spawn().
>
> Example code (mac specific): https://gist.github.com/dstibrany/7094835
>
> (basically this looks for the LISTEN servers of a given PID, in this case
> the sleep(1) command, which there shouldn't be any for).
>
> Bug or intended behaviour?

It's a libuv bug (one that I could've sworn I fixed a long time ago;
maybe it got lost in a merge conflict.)

I've filed an issue[1].  You can find a quick workaround below.

[1] https://github.com/joyent/libuv/issues/962

diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
index c9df979..dff5f2b 100644
--- a/deps/uv/src/unix/stream.c
+++ b/deps/uv/src/unix/stream.c
@@ -1042,6 +1042,7 @@ static void uv__read(uv_stream_t* stream) {
               void* pv = CMSG_DATA(cmsg);
               int* pi = pv;
               stream->accepted_fd = *pi;
+              uv__cloexec(stream->accepted_fd, 1);
             }

           } else {

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to