In case a fd option is given to fs.createReadStream a read will instantly
happen. But in the edge case where fd point to an empty file and .pause()
was executed instantly, the end event would emit since no async wait was
between fs.createReadStream and the file read there emits end.
Said test relies a great deal on internals and implementation details (I should
know, I wrote it). Patch it up to work with libuv's new refcounting scheme.
In case a worker would spawn a new subprocess with process.env, NODE_UNIQUE_ID
would have been a part of the env. Making the new subprocess believe it is a
worker, this would result in some confusion if the subprocess where to listen to
a port, since the server handle request would then be relayed to the worker.
This patch removes the NODE_UNIQUE_ID flag from process.env on startup so any
subprocess spawned by a worker is a normal process with no cluster stuff.
request.end() would sometimes try to write a zero-length buffer to the socket.
Don't do that, it triggers an unnecessary EPIPE when the other end has closed
the connection.
Fixes#3257.
* process._getActiveHandles() returns a list containing all active handles
(timers, sockets, etc.) that have not been unref'd.
* process._getActiveRequests() returns a list of active requests (in-flight
actions like connecting to a remote host, writing data to a socket, etc.).
child_process.fork() support sending native hander object, this patch add support for sending
net.Server and net.Socket object by converting the object to a native handle object and back
to a useful object again.
Note when sending a Socket there was emitted by a net Server object, the server.connections
property becomes null, because it is no longer possible to known when it is destroyed.
Prevents accidental inheritance by child processes. If the child process is a
node process, it would try to set up a channel with the parent and consequently
never quit because the channel kept the event loop alive.
Fixes#3240.
So instead of:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
You will now see:
path/to/foo.js:1
throw new Error('bar');
^
This is a sub-set of isaacs patch here:
https://github.com/joyent/node/issues/3235
The difference is that this patch purely adresses the exception output,
but does not try to make any behavior changes / improvements.
This patch now reports the proper throw call site for exceptions
triggered within process.nextTick. So instead of this:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
You will now see:
mydir/myscript.js:15
throw new Error('My Error');
^
From my testing this patch causes no performance regressions, but does
greatly simplify processing the nextTickQueue.
Regarding discussion in #3198. Passing the worker as an argument
to an event emitted on the worker is redundant, and an unnecessary
break in consistency vs the events on the ChildProcess objects.
It was removed from 'exit', but 'listening' and others were
overlooked. This corrects that oversight.
test: fixes due to new cluster api.
- changed worker `death` to `exit`.
- corrected argument type expected by worker `exit` handler.
test: more tests of cluster.worker death
cluster: fixed arguments on worker 'exit' event
worker 'exit' event now emits arguments consistent with the
corresponding event in child_process module.