This is the Node side of the fix for Node's cluster module on Windows.
https://github.com/joyent/node/issues/7691
The other required part is
https://github.com/joyent/libuv/pull/1384
Windows and Unix return certain socket errors (i.e. EADDRINUSE) at
different times: bind on Windows, and listen on Unix.
In an effort to hide this difference, libuv on Windows stores such
errors in the bind_error field of uv_tcp_t, to defer raising it at
listen time.
This worked fine except for the case in which a socket is shared in
a Node cluster and a bind error occurs.
A previous attempt to fix this (
d1e6be14603da36fe00e
) was flawed becaused in an attempt to relay the error at the JS level
it caused the master to start accepting connections.
With this new approach, libuv itself is relaying the bind errors,
providing for a uniform behavior of uv_tcp_listen.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
v0.10 and node docs specific that in a worker, the 'message' and 'error'
event emits on process, and on cluster.worker.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
internet/test-dns.js assumes that ::1 always resolves to "localhost" on
all platforms. This is not what happens in reality. Some platforms
resolve it to "ip6-localhost" too. There doesn't seem to be any consensus
on what's the right thing to do. However, most sane platforms will use
either one of these two values.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Prevent test-process-kill-pid.js tests suite from sending SIGHUP
to its process group, which was causing the test runner to terminate.
Fix jenkins' jobs for nodejs-master.
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
Between 0.11.1 and 0.11.2, the message and error events stopped
being usable via the cluster.worker object. This commit makes
them usable again. Closes#7998.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Currently, invalid usage such as:
process.kill('SIGTERM')
process.kill(null)
process.kill(undefined);
all coerce the pid to 0, and signal the current process.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Currently, stringification of an empty array outputs a single
separator character. This commit causes an empty array to output
the empty string.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
When TLS Alert is occured in handshake, ClearOut only write it into
wbio and does not flush to socket. TLS Alert should be written to
socket with EncOut before socket is destroyed within its error
callback.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
According to V8 changelog, `armv7` config variable was replaced by
`arm_version`, with value either '7', '6' or 'default'.
Detect ARMv7 and ARMv6 CPUs and default to 'default'.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Currently, checkExecSyncError() attempts to access the contents
of stderr. When stdio is set to 'ignore', this causes a crash.
This commit adds a check on the access of stderr. Closes#7966.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Documentation claimed it accepted a single label argument, as time and
timeEnd do, which was incorrect.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
This allows embedders enough control to initialize node, run the
event loop, and cleanly exit (including calling handlers).
Signed-off-by: Fedor Indutny <fedor@indutny.com>
A ReadableStream with a base64 StringDecoder backed by only
one or two bytes would fail to output its partial data before
ending. This fix adds a check to see if the `read` was triggered
by an internal `flow`, and if so, empties any remaining data.
fixes#7914.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Emits on every call to cluster.setupMaster(), even if no new settings
are given. This is because calling cluster.setupMaster() without
arguments (or with an empty options object) results in the settings
being restored to their defaults.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Only attributes of 'cluster.settings' will be modified after the first
call, leaving all other cluster initialization alone. Each call that
includes a 'settings' argument triggers a 'setup' event to be emitted.
Instead of each call resetting all values to their defaults, use the
current settings (if any) as the default. This retains setupMaster's
support how cluster.fork() uses setupMaster() to ensure
cluster.settings has been populated.
Update example in docs to use current node coding style and include
an example of progressive configuration.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Pass in the v8::Context, instead of creating it
within CreateEnvironment. This allows callers
to use a pre-existing context.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
The spawnSync() cwd option was being copied to the incorrect
location. This commit copies to the correct location.
Closes#7824
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Switch condition order to check for null before calling isNaN().
Also remove two unnecessary calls to isNaN() that are already
covered by calls to isFinite(). This commit targets v0.10, as
opposed to #7891, which targets master (suggested by
@bnoordhuis). Closes#7840.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Use a util.deprecate wrapper to issue warnings like any other
deprecated API. The option has been marked as deprecated in the docs
since v0.5.11.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Default highWaterMark is now set properly when using stream Duplex's
writableObjectMode and readableObjectMode options.
Added condition to the already existing split objectMode test to ensure
the highWaterMark is being set to the correct default value on both the
ReadableState and WritableState for readableObjectMode and
writableObjectMode.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Documentation for console.assert incorrectly described message as a
single message, but it is a format.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Fix for `error` events emitting only once when reconnecting
a single instance of net.Socket.
Fixesjoyent/node#7888
Signed-off-by: Fedor Indutny <fedor@indutny.com>
A udp packet can have 0 content. In that case nread will be equal to 0,
but addr != NULL.
Add test case for empty data gram packets and fixed test that checked
for OOB when length == 0.
Signed-off-by: Trevor Norris <trev.norris@gmail.com>