On Windows, path.isAbsolute() returns an empty string on failed cases.
This forces the return value to always be boolean.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
When backporting f8193ab into v0.10, a regression was introduced. Timers
with non-integer timeout could trigger a infinite recursion with 100%
cpu usage. This commit backports 93b0624 which fixes the regression.
After backporting f8193ab, instead of using Date.now(), timers would use
Timer.now() to determine if they had expired. However, Timer.now() is
based on loop->time, which is not updated when a timer's remaining time
is > 0 and < 1. Timers would thus never timeout if their remaining time
was at some point > 0 and < 1.
With this commit, Timer.now() updates loop->time itself, and timers
always timeout eventually.
Fixes#8065 and #8068.
Callbacks in node are usually asynchronous, and should never be
sometimes synchronous, and sometimes asynchronous.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Internal function trim(arr). 2nd parameter of slice() should be slice's
end index (not included). Because of function normalize() (called before
trim()), "start" is always zero so the bug -for now- has no effect, but
its a bug waiting to happen.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
A streams1 stream will have its falsy values such as 0, false, or ""
eaten by the upgrade to streams2, even when objectMode is enabled.
Include test for said cases.
Reviewed-by: isaacs <i@izs.me>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
This patch adds a fast path for parsing of simple path-only URLs, as commonly
found in HTTP requests received by a server.
Benchmark results [ms], before / after patch:
/foo/bar 0.008956 0.000418 (fast path used)
http://example.com/ 0.011426 0.011437 (normal slow path, no change)
In a simple 'ab' benchmark of a single-threaded web server, this patch
increases the request rate from around 6400 to 7400 req/s.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Original commit message:
timers: use uv_now instead of Date.now
This saves a few calls to gettimeofday which can be expensive, and
potentially subject to clock drift. Instead use the loop time which
uses hrtime internally.
In addition to the backport, this commit:
- keeps _idleStart timers' property which is still set to
Date.now() to avoid breaking existing code that uses it, even if
its use is discouraged.
- adds automated tests. These tests use a specific branch of
libfaketime that hasn't been submitted upstream yet. libfaketime
is git cloned if needed when running automated tests.
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
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>