test: mark more tests as flaky

Marking these two tests as flaky, since they have been failing
intermittenly in recent builds:
test-debug-signal-cluster
test-cluster-basic
lib,src: fix spawnSync ignoring its 'env' option

PR-URL: https://github.com/joyent/node/pull/8546
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
test: add test for spawnSync() env option

PR-URL: https://github.com/joyent/node/pull/8845
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: clarify create{Read,Write}Stream fd option

Clarify the fd option: it is preferred to the path parameter, omits
the "open" event if given, and is available on WriteStreams as well.

PR-URL: https://github.com/joyent/node/issues/7707
Fixes: https://github.com/joyent/node/issues/7707
Fixes: https://github.com/joyent/node/issues/7708
Fixes: https://github.com/joyent/node/issues/4367
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
zlib: support concatenated gzip files

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/6442
debugger: fix unhandled error in setBreakpoint

Fix Interface.setBreakpoint() to correctly handle an attempt to set a
breakpoint in the current script when there is no current script.
This usually happens when the debugged process is not paused.

Fixes: https://github.com/joyent/node/issues/6453
PR-URL: https://github.com/joyent/node/pull/6460
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
src: fix windows build error

Fix a Windows-only build error that was introduced in
commit 1183ba4 ("zlib: support concatenated gzip files").

Rename the NO_ERROR and FAILED enumerations, they conflict
with macros of the same name in <winerror.h>.

PR-URL: https://github.com/joyent/node/pull/8893
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
stream: switch _writableState.buffer to queue

In cases where many small writes are made to a stream
lacking _writev, the array data structure backing the
WriteReq buffer would greatly increase GC pressure.

Specifically, in the fs.WriteStream case, the
clearBuffer routine would only clear a single WriteReq
from the buffer before exiting, but would cause the
entire backing array to be GC'd. Switching to [].shift
lessened pressure, but still the bulk of the time was
spent in memcpy.

This replaces that structure with a linked list-backed
queue so that adding and removing from the queue is O(1).
In the _writev case, collecting the buffer requires an
O(N) loop over the buffer, but that was already being
performed to collect callbacks, so slowdown should be
neglible.

PR-URL: https://github.com/joyent/node/pull/8826
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: add details for http res/req end callback

Add documentation for the callback parameter of http.ClientRequest's and
http.ServerResponse's end methods.

Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
cluster: don't assume all workers bind same ports

For shared handles that do not get connection close messages (UDP/dgram
is the only example of this), cluster must not assume that a port
listened on by one worker is listened on by all workers.
cluster: cluster.disconnect() should check status

Workers that are already disconnected but not yet exited should not be
disconnected, trying to do so raises exceptions.