Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
build: fix use of strict aliasing
The -fno-strict-aliasing flag was added to fix compilation warnings when building Node.js with GCC <= 4.4 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
lib: fix stdio/ipc sync i/o regression
process.send() should be synchronous, it should block until the message has been sent in full, but it wasn't after the second-to-last libuv upgrade because of commit libuv/libuv@393c1c5 ("unix: set non-block mode in uv_{pipe,tcp,udp}_open"), which made its way into io.js in commit 07bd05b ("deps: update libuv to 1.2.1"). Commit libuv/libuv@b36d4ff ("unix: implement uv_stream_set_blocking()") as landed in io.js in commit 9681fca ("deps: update libuv to 1.4.0") makes it possible to restore the synchronous behavior again and that's precisely what this commit does. The same line of reasoning applies to `net.Socket({ fd: 1 })`: creating a socket object from a stdio file descriptor, like the `process.stdout` getter does, should put the file descriptor in blocking mode for compatibility reasons. Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
Float patch to fix pipe on Windows. Original commit message: win: fix pipe blocking writes In the code path for pipe blocking writes, WriteFile is already posting a completion packet to the I/O completion port. POST_COMPLETION_FOR_REQ was causing the same request to get returned twice by GetCompletionStatusEx. Also on the same code path, we were waiting on the wrong event. We need to update queued_bytes and write_queue_size when a blocking write request completes asynchronously. Ref: libuv/libuv#238 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
uv: fix setsockopt for multicast options
Float patch to fix setsockopt for multicast on Solaris and derivatives. Original commit message: solaris: fix setsockopt for multicast options On Solaris and derivatives such as SmartOS, the length of socket options for multicast and ttl options is not always sizeof(char). This fixes the udp_options and udp_options6 tests. Ref: libuv/libuv#243 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
uv: fix size calculation in select() fallback
Original commit message: darwin: fix size calculation in select() fallback Apple's `fd_set` stores its bits in an array of 32-bit integers, which means `FD_ISSET()` may read out of bounds if we allocate storage at byte granularity. There's also a chance that the `select()` call could corrupt the heap, although I didn't investigate that. This issue was discovered by LLVM's AddressSanitizer which caught `FD_ISSET()` trying to read out of bounds. Ref: libuv/libuv#241 Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
deps: indicate uv has been patched
Because we are floating several patches on top of libuv, make that apparent in the version number. Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9179
deps: replace all headers in openssl
change all openssl/include/openssl/*.h to include resolved symbolic links and openssl/crypto/opensslconf.h to refer config/opensslconf.h PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
deps: separate sha256/sha512-x86_64.pl for openssl
sha256-x86_64.pl does not exist in the origin openssl distribution. It was copied from sha512-x86_64.pl and both sha256/sha512 scripts were modified so as to generates only one asm file specified as its key hash length. PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
deps: remove vpaesni-x86_64.asm in x64-win32-masm
deps: remove unused backup file in openssl asm
deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm.orig was accidentally committed before. PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
openssl: fix keypress requirement in apps on win32
2015.03.23, Version 0.10.38 (Maintenance)
* openssl: upgrade to 1.0.1m (Addressing multiple CVEs)
watchdog: fix timeout for early polling return
Switch from running the loop with UV_RUN_ONCE to UV_RUN_DEFAULT, because it's possible that the poll returns earlier than expected and thus the timer is not run on a single interation. The loop is not stopped either from the timer callback or from the async handle's. Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9410
Merge branch 'v0.10.38-release' into v0.10
deps: replace all headers in openssl
change all openssl/include/openssl/*.h to include resolved symbolic links and openssl/crypto/opensslconf.h to refer config/opensslconf.h PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
deps: separate sha256/sha512-x86_64.pl for openssl
sha256-x86_64.pl does not exist in the origin openssl distribution. It was copied from sha512-x86_64.pl and both sha256/sha512 scripts were modified so as to generates only one asm file specified as its key hash length. PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
deps: remove vpaesni-x86_64.asm in x64-win32-masm
deps: remove unused backup file in openssl asm
deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm.orig was accidentally committed before. PR: #9451 PR-URL: #9451 Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
openssl: fix keypress requirement in apps on win32
2015.03.23, Version 0.12.1 (Stable)
* openssl: upgrade to 1.0.1m (Addressing multiple CVES)
Merge remote-tracking branch 'upstream/v0.10' into v0.12
Conflicts: ChangeLog src/node_version.h
path: refactor for performance and consistency
Improve performance by: + Not leaking the `arguments` object! + Getting the last character of a string by index, instead of with `.substr()` or `.slice()` Improve code consistency by: + Using `[]` instead of `.charAt()` where possible + Using a function declaration instead of a var declaration + Using `.slice()` with clearer arguments + Checking if `dir` is truthy in `win32.format` (added tests for this) Improve both by: + Making the reusable `trimArray()` function + Standardizing getting certain path statistics with the new `win32StatPath()` function Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9289
test: Env variable to specify directory for pipes
At the uv layer pipes are connected with uv_pipe_connect. The current spec for this method indicates that the maximum length is limited to the size of length of sizeof(sockaddr_un.sun_path), typically between 92 and 108 bytes. Anything longer than that just gets truncated. The simple testsuite currently creates pipes in directories under the directory where node was built. In our jenkins jobs this sometimes ends up being a deep enough path that the path for the pipes is getting truncated. The result is that tests using pipes fail with errors that don't make it obvious what the problem is. Even if the errors were helpful, we still need a way to avoid the truncation. This patch adds the environment variable NODE_PIPE_DIR. If set the tests create pipes in this directory instead of the current defaults. In addition the test harness is updated to remove/delete this directory before/after each test is run. modified: test/common.js modified: test/simple/test-net-pipe-connect-errors.js modified: test/testpy/__init__.py modified: test/simple/test-cluster-eaccess.js Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #9381
test: address timing issues in simple http tests
simple tests test-http-request-end.js, test-http-default-encoding.js hangs in AIX. The root cause for both the failures is related to the timing with which packets are sent between the client and server. On the client side, one factor that affects the timing is Nagle's algorithm. With Nagle enabled there may be a delay between two packets as the stack may wait until either: a. An acknowledgement for the first packet is received, or b. 200 ms elapses. before sending the second packet. Similarly at the server side 2 sequential packages can be delivered to the application either together or separatly. On AIX we see that they are delivered separately to the server, while on Linux delivered together. If we change the timing, for example disabling Nagle on AIX we see the 2 packets delivered together and the tests pass. In the test case simple/test-http-request-end.js, the client request handler of the server receives and stores the data in a data callback, closes the server in a request end callback, and writes to the client and ends the response, in-line with the request receipt. An HTTP parser module parses the incoming message, and invokes callback routines which are registered for HTTP events (such as header, body, end etc.) Because the termination sequence arrive in a separate packet, there is a delay in parsing that message and identify that the client request ended (and thereby invoke the request end call backhandler). Due to this delay, the response close happens first, which in-turn destroys the server socket leading to the fd and watcher removal from the uv loop abandoning further events on this connection, and end call back never being called, causing the reported hang. simple/test-http-default-encoding.js suffers from the same problem. Also, remove the timer logic from the test case. Test harness anyways contain a timer which controls the individual tests so remove such controls from the test case, as suggested by @tjfontaine Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> PR-URL: #9432
Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #14180
http: fix assert on data/end after socket error
This change is a backport of 1a3ca82 from io.js. Original commit message: Read all pending data out of the socket on `error` event and ensure that no `data`/`end` handlers will be invoked on `socket.destroy()`. Otherwise following assertion happens: AssertionError: null == true at TLSSocket.socketOnData (_http_client.js:308:3) at TLSSocket.emit (events.js:107:17) at TLSSocket.Readable.read (_stream_readable.js:373:10) at TLSSocket.socketCloseListener (_http_client.js:229:10) at TLSSocket.emit (events.js:129:20) at TCP.close (net.js:476:12) Fix: #9348 PR-URL: nodejs/node#1103 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com> Fixes #9348. Reviewed-By: Julien Gilli <julien.gilli@joyent.com> PR-URL: #14087
src: backport fix for SIGINT crash on FreeBSD
This is a backport of b64983d. Original commit message: src: reset signal handler to SIG_DFL on FreeBSD FreeBSD has a nasty bug with SA_RESETHAND reseting the SA_SIGINFO, that is in turn set for a libthr wrapper. This leads to a crash. Work around the issue by manually setting SIG_DFL in the signal handler. Fix: #9326 PR-URL: nodejs/node#1218 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Fixes #9326. Reviewed-By: Trevor Norris <trev.norris@gmail.com> PR-URL: #14184
test: make cluster tests more time tolerant
simple tests test-cluster-master-error.js, test-cluster-master-kill.js fails in AIX with assertion failure indicating that the workers were alive even after the master terminated. A 200ms leeway is provided for the workers to actually terminate, but the isAlive check returns true in both the cases. In AIX, the workers were actually terminating, but they took more time - as much as 800ms (normal) to 1000ms (in rare cases). Based on a C test we ran, it is found that the exit routines in AIX is a bit more longer than that in Linux. There are a number of cleanup activities performed in exit() system call, and depending on when the signal handlers are shutdown in that sequence, the process will be deemed as dead or alive, from another process's perspective. process.kill(pid) is used in the test case to check the liveliness of the worker, and when the kill() call is issued, even if the target process is in it's exit sequences, if the signal handlers are not shut down, it will respond to external signals, causing those calls to pass. This fix extends the additional timeout for all platforms Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> PR-URL: #9431
2015.03.31, Version 0.12.2 (Stable)
* uv: Upgrade to 1.4.2 * npm: Upgrade to 2.7.4 * V8: do not add extra newline in log file (Julien Gilli) * V8: Fix --max_old_space_size=4096 integer overflow (Andrei Sedoi) * asyncwrap: fix constructor condition for early ret (Trevor Norris) * buffer: align chunks on 8-byte boundary (Fedor Indutny) * buffer: fix pool offset adjustment (Trevor Norris) * build: fix use of strict aliasing (Trevor Norris) * console: allow Object.prototype fields as labels (Colin Ihrig) * fs: make F_OK/R_OK/W_OK/X_OK not writable (Jackson Tian) * fs: properly handle fd passed to truncate() (Bruno Jouhier) * http: fix assert on data/end after socket error (Fedor Indutny) * lib: fix max size check in Buffer constructor (Ben Noordhuis) * lib: fix stdio/ipc sync i/o regression (Ben Noordhuis) * module: replace NativeModule.require (Herbert Vojčík) * net: allow port 0 in connect() (cjihrig) * net: unref timer in parent sockets (Fedor Indutny) * path: refactor for performance and consistency (Nathan Woltman) * smalloc: extend user API (Trevor Norris) * src: fix for SIGINT crash on FreeBSD (Fedor Indutny) * src: fix builtin modules failing with --use-strict (Julien Gilli) * watchdog: fix timeout for early polling return (Saúl Ibarra Corretgé)
Merge branch 'v0.12.2-release' into v0.12
test: relax the timing window in test-child-process-fork-net2.js
In Linux, simple/test-child-process-fork-net2.js fails intermittently. In SuSE Linux system, under network high load situations, this failure is consistently reproducible. The test case tests whether the TCP connections which were established between the processes terminate in a timely and clean manner. After some iterations of data transfer on established connections, the server is closed. The server does not get closed immediately, instead waits for all the active connections to terminate. A timed (200ms) callback closes the connections, which eventually closes the server. The start is the time when the server close is invoked. The end is the time when the server is actually closed(onClose call back invoked). Given that there is a minimum delay of 200ms before the connections are terminated, expecting the elapsed time above 190 is reasonable and fair, but looks like the leeway of 800ms for the upper bounds seem to be too stringent, and breaking some scenarios of network load. Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> PR-URL: #14129
src: backport ignore ENOTCONN on shutdown race
This is a backport of ea37ac0 Original commit message: On AIX, OS X and the BSDs, calling shutdown() on one end of a pipe when the other end has closed the connection fails with ENOTCONN. The sequential/test-child-process-execsync test failed sporadically because of a race between the parent and the child where one closed its end of the pipe before the other got around to calling shutdown() on its end of the pipe. Libuv is not the right place to handle that because it can't tell if the ENOTCONN error is genuine but io.js can. Refs: libuv/libuv#268 PR-URL: iojs#1214 Reviewed-By: Bert Belder <bertbelder@gmail.com> Fixes: #9444.