Have you tried wrapping it in a socket using new Socket({ fd: 11 })?

-Tim

Ryan Schmidt schreef op 05-11-14 om 04:18:
Does anyone have any thoughts on the below?

Or is there a better zero-downtime deployment module I should use instead of 
naught that has already solved this problem of how to pass along a socket on a 
file descriptor?


On Nov 2, 2014, at 6:32 PM, Ryan Schmidt wrote:

My server is started by another process that hands it a socket on file 
descriptor 11. I start my server this way:

http.createServer(app).listen({fd: 11});

Now I want to modify this to enable zero-downtime deployments, so I would like to have 
naught start my server. The question is: how can I get naught to pass fd 11 to my script 
so that I can listen on it? Or, how do I "connect" naught's fd 11 with my 
script's fd 11?

I have tried modifying naught's spawn invocation so that it reads:

    var stdio = [process.stdin, stdoutValue, stderrValue, 'ipc'];
    stdio[11] = 11;
    master = spawn(process.execPath, nodeArgs.concat([path.join(__dirname, 
"master.js"), workerCount, script]).concat(argv), {
      env: process.env,
      stdio: stdio,
      cwd: process.cwd(),
    });

Basically I have added "stdio[11] = 11;" However this doesn't seem to be working. My server is 
failing to listen, getting the error "Error: listen ENOTSOCK". The node documentation says a 
positive integer in the stdio array "is interpreted as a file descriptor that is is currently open in 
the parent process. It is shared with the child process". I'm wondering if the problem is that the file 
descriptor, though available to my parent process, is not open yet. If so, how should I open it? Just fs.open?

Is there some way for naught (or any process) to know which fds are being made 
available to it, and pass them on to the child without needing to be told what 
they are? Is it possible for a process to automatically pass all fds to a child 
without having to enumerate them?


I have also filed this issue as a naught ticket but haven't heard back yet:

https://github.com/andrewrk/naught/issues/65




--
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/545A256E.6020508%40netsend.nl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to