Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: marking recent test failures as flaky #2679

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 44 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,53 +331,53 @@ information about the governance of the Node.js project, see

### TSC (Technical Steering Committee)

* **Ben Noordhuis** <[email protected]> ([@bnoordhuis](https://github.com/bnoordhuis))
* **Bert Belder** <bertbelder@gmail.com> ([@piscisaureus](https://github.com/piscisaureus))
* **Fedor Indutny** <fedor.indutny@gmail.com> ([@indutny](https://github.com/indutny))
* **Trevor Norris** <trev.norris@gmail.com> ([@trevnorris](https://github.com/trevnorris))
* **Chris Dickinson** <christopher.s.dickinson@gmail.com> ([@chrisdickinson](https://github.com/chrisdickinson))
* **Rod Vagg** <[email protected]> ([@rvagg](https://github.com/rvagg))
* **Jeremiah Senkpiel** <fishrock123@rocketmail.com> ([@fishrock123](https://github.com/fishrock123))
* **Colin Ihrig** <[email protected]> ([@cjihrig](https://github.com/cjihrig))
* **Alexis Campailla** <[email protected]> ([@orangemocha](https://github.com/orangemocha))
* **Julien Gilli** <jgilli@nodejs.org> ([@misterdjules](https://github.com/misterdjules))
* **James M Snell** <jasnell@gmail.com> ([@jasnell](https://github.com/jasnell))
* **Steven R Loomis** <[email protected]> ([@srl295](https://github.com/srl295))
* **Michael Dawson** <[email protected]> ([@mhdawson](https://github.com/mhdawson))
* **Shigeki Ohtsu** <[email protected]> ([@shigeki](https://github.com/shigeki))
* **Brian White** <[email protected]> ([@mscdex](https://github.com/mscdex))
* [bnoordhuis](https://github.com/bnoordhuis) - **Ben Noordhuis** <[email protected]>
* [chrisdickinson](https://github.com/chrisdickinson) - **Chris Dickinson** <christopher.s.dickinson@gmail.com>
* [cjihrig](https://github.com/cjihrig) - **Colin Ihrig** <cjihrig@gmail.com>
* [fishrock123](https://github.com/fishrock123) - **Jeremiah Senkpiel** <fishrock123@rocketmail.com>
* [indutny](https://github.com/indutny) - **Fedor Indutny** <fedor.indutny@gmail.com>
* [jasnell](https://github.com/jasnell) - **James M Snell** <[email protected]>
* [mhdawson](https://github.com/mhdawson) - **Michael Dawson** <[email protected].com>
* [misterdjules](https://github.com/misterdjules) - **Julien Gilli** <[email protected]>
* [mscdex](https://github.com/mscdex) - **Brian White** <[email protected]>
* [orangemocha](https://github.com/orangemocha) - **Alexis Campailla** <orangemocha@nodejs.org>
* [piscisaureus](https://github.com/piscisaureus) - **Bert Belder** <bertbelder@gmail.com>
* [rvagg](https://github.com/rvagg) - **Rod Vagg** <[email protected]>
* [shigeki](https://github.com/shigeki) - **Shigeki Ohtsu** <[email protected]>
* [srl295](https://github.com/srl295) - **Steven R Loomis** <[email protected]>
* [trevnorris](https://github.com/trevnorris) - **Trevor Norris** <[email protected]>

### Collaborators

* **Isaac Z. Schlueter** <[email protected]> ([@isaacs](https://github.com/isaacs))
* **Mikeal Rogers** <mikeal.rogers@gmail.com> ([@mikeal](https://github.com/mikeal))
* **Thorsten Lorenz** <[email protected]> ([@thlorenz](https://github.com/thlorenz))
* **Stephen Belanger** <admin@stephenbelanger.com> ([@qard](https://github.com/qard))
* **Evan Lucas** <evanlucas@me.com> ([@evanlucas](https://github.com/evanlucas))
* **Brendan Ashworth** <[email protected]> ([@brendanashworth](https://github.com/brendanashworth))
* **Vladimir Kurchatkin** <[email protected]> ([@vkurchatkin](https://github.com/vkurchatkin))
* **Nikolai Vavilov** <vvnicholas@gmail.com> ([@seishun](https://github.com/seishun))
* **Nicu Micleușanu** <micnic90@gmail.com> ([@micnic](https://github.com/micnic))
* **Aleksey Smolenchuk** <[email protected]> ([@lxe](https://github.com/lxe))
* **Sam Roberts** <vieuxtech@gmail.com> ([@sam-github](https://github.com/sam-github))
* **Wyatt Preul** <wpreul@gmail.com> ([@geek](https://github.com/geek))
* **Christian Tellnes** <[email protected]> ([@tellnes](https://github.com/tellnes))
* **Robert Kowalski** <[email protected]> ([@robertkowalski](https://github.com/robertkowalski))
* **Julian Duque** <[email protected]> ([@julianduque](https://github.com/julianduque))
* **Johan Bergström** <[email protected]> ([@jbergstroem](https://github.com/jbergstroem))
* **Roman Reiss** <[email protected]> ([@silverwind](https://github.com/silverwind))
* **Petka Antonov** <[email protected]> ([@petkaantonov](https://github.com/petkaantonov))
* **Yosuke Furukawa** <[email protected]> ([@yosuke-furukawa](https://github.com/yosuke-furukawa))
* **Alex Kocharin** <[email protected]> ([@rlidwka](https://github.com/rlidwka))
* **Christopher Monsanto** <[email protected]> ([@monsanto](https://github.com/monsanto))
* **Ali Ijaz Sheikh** <[email protected]> ([@ofrobots](https://github.com/ofrobots))
* **Oleg Elifantiev** <[email protected]> ([@Olegas](https://github.com/Olegas))
* **Domenic Denicola** <[email protected]> ([@domenic](https://github.com/domenic))
* **Rich Trott** <rtrott@gmail.com> ([@Trott](https://github.com/Trott))
* **Сковорода Никита Андреевич** <[email protected]> ([@ChALkeR](https://github.com/ChALkeR))
* **Sakthipriyan Vairamani** <thechargingvolcano@gmail.com> ([@thefourtheye](https://github.com/thefourtheye))
* **Michaël Zasso** <mic.besace@gmail.com> ([@targos](https://github.com/targos))
* **João Reis** <reis@janeasystems.com> ([@joaocgreis](https://github.com/joaocgreis))
* [brendanashworth](https://github.com/brendanashworth) - **Brendan Ashworth** <[email protected]>
* [ChALkeR](https://github.com/ChALkeR) - **Сковорода Никита Андреевич** <chalkerx@gmail.com>
* [domenic](https://github.com/domenic) - **Domenic Denicola** <[email protected]>
* [evanlucas](https://github.com/evanlucas) - **Evan Lucas** <evanlucas@me.com>
* [geek](https://github.com/geek) - **Wyatt Preul** <wpreul@gmail.com>
* [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <[email protected]>
* [jbergstroem](https://github.com/jbergstroem) - **Johan Bergström** <[email protected]>
* [joaocgreis](https://github.com/joaocgreis) - **João Reis** <reis@janeasystems.com>
* [julianduque](https://github.com/julianduque) - **Julian Duque** <julianduquej@gmail.com>
* [lxe](https://github.com/lxe) - **Aleksey Smolenchuk** <[email protected]>
* [micnic](https://github.com/micnic) - **Nicu Micleușanu** <micnic90@gmail.com>
* [mikeal](https://github.com/mikeal) - **Mikeal Rogers** <mikeal.rogers@gmail.com>
* [monsanto](https://github.com/monsanto) - **Christopher Monsanto** <[email protected]>
* [ofrobots](https://github.com/ofrobots) - **Ali Ijaz Sheikh** <[email protected]>
* [Olegas](https://github.com/Olegas) - **Oleg Elifantiev** <[email protected]>
* [petkaantonov](https://github.com/petkaantonov) - **Petka Antonov** <[email protected]>
* [qard](https://github.com/qard) - **Stephen Belanger** <[email protected]>
* [rlidwka](https://github.com/rlidwka) - **Alex Kocharin** <[email protected]>
* [robertkowalski](https://github.com/robertkowalski) - **Robert Kowalski** <[email protected]>
* [sam-github](https://github.com/sam-github) - **Sam Roberts** <[email protected]>
* [seishun](https://github.com/seishun) - **Nikolai Vavilov** <[email protected]>
* [silverwind](https://github.com/silverwind) - **Roman Reiss** <[email protected]>
* [targos](https://github.com/targos) - **Michaël Zasso** <[email protected]>
* [tellnes](https://github.com/tellnes) - **Christian Tellnes** <[email protected]>
* [thefourtheye](https://github.com/thefourtheye) - **Sakthipriyan Vairamani** <thechargingvolcano@gmail.com>
* [thlorenz](https://github.com/thlorenz) - **Thorsten Lorenz** <[email protected]>
* [Trott](https://github.com/Trott) - **Rich Trott** <rtrott@gmail.com>
* [vkurchatkin](https://github.com/vkurchatkin) - **Vladimir Kurchatkin** <vladimir.kurchatkin@gmail.com>
* [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com>

Collaborators & TSC members follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in
maintaining the Node.js project.
Expand Down
23 changes: 14 additions & 9 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,15 @@ to a process.

See `kill(2)`

### child.send(message[, sendHandle])
### child.send(message[, sendHandle][, callback])

* `message` {Object}
* `sendHandle` {Handle object}
* `callback` {Function}
* Return: Boolean

When using `child_process.fork()` you can write to the child using
`child.send(message, [sendHandle])` and messages are received by
`child.send(message[, sendHandle][, callback])` and messages are received by
a `'message'` event on the child.

For example:
Expand All @@ -246,11 +248,6 @@ And then the child script, `'sub.js'` might look like this:
In the child the `process` object will have a `send()` method, and `process`
will emit objects each time it receives a message on its channel.

Please note that the `send()` method on both the parent and child are
synchronous - sending large chunks of data is not advised (pipes can be used
instead, see
[`child_process.spawn`](#child_process_child_process_spawn_command_args_options)).

There is a special case when sending a `{cmd: 'NODE_foo'}` message. All messages
containing a `NODE_` prefix in its `cmd` property will not be emitted in
the `message` event, since they are internal messages used by Node.js core.
Expand All @@ -261,8 +258,16 @@ The `sendHandle` option to `child.send()` is for sending a TCP server or
socket object to another process. The child will receive the object as its
second argument to the `message` event.

Emits an `'error'` event if the message cannot be sent, for example because
the child process has already exited.
The `callback` option is a function that is invoked after the message is
sent but before the target may have received it. It is called with a single
argument: `null` on success, or an `Error` object on failure.

`child.send()` emits an `'error'` event if no callback was given and the message
cannot be sent, for example because the child process has already exited.

Returns `true` under normal circumstances or `false` when the backlog of
unsent messages exceeds a threshold that makes it unwise to send more.
Use the callback mechanism to implement flow control.

#### Example: sending server object

Expand Down
4 changes: 3 additions & 1 deletion doc/api/cluster.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,12 @@ exit, the master may choose not to respawn a worker based on this value.
// kill worker
worker.kill();

### worker.send(message[, sendHandle])
### worker.send(message[, sendHandle][, callback])

* `message` {Object}
* `sendHandle` {Handle object}
* `callback` {Function}
* Return: Boolean

Send a message to a worker or master, optionally with a handle.

Expand Down
12 changes: 8 additions & 4 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,14 @@ function slowToString(encoding, start, end) {


Buffer.prototype.toString = function() {
const length = this.length | 0;
if (arguments.length === 0)
return this.utf8Slice(0, length);
return slowToString.apply(this, arguments);
if (arguments.length === 0) {
var result = this.utf8Slice(0, this.length);
} else {
var result = slowToString.apply(this, arguments);
}
if (result === undefined)
throw new Error('toString failed');
return result;
};


Expand Down
10 changes: 3 additions & 7 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,12 @@ exports._forkChild = function(fd) {
var p = new Pipe(true);
p.open(fd);
p.unref();
setupChannel(process, p);

var refs = 0;
const control = setupChannel(process, p);
process.on('newListener', function(name) {
if (name !== 'message' && name !== 'disconnect') return;
if (++refs === 1) p.ref();
if (name === 'message' || name === 'disconnect') control.ref();
});
process.on('removeListener', function(name) {
if (name !== 'message' && name !== 'disconnect') return;
if (--refs === 0) p.unref();
if (name === 'message' || name === 'disconnect') control.unref();
});
};

Expand Down
91 changes: 72 additions & 19 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,25 @@ function setupChannel(target, channel) {
target._channel = channel;
target._handleQueue = null;

const control = new class extends EventEmitter {
constructor() {
super();
this.channel = channel;
this.refs = 0;
}
ref() {
if (++this.refs === 1) {
this.channel.ref();
}
}
unref() {
if (--this.refs === 0) {
this.channel.unref();
this.emit('unref');
}
}
};

var decoder = new StringDecoder('utf8');
var jsonBuffer = '';
channel.buffering = false;
Expand Down Expand Up @@ -446,7 +465,7 @@ function setupChannel(target, channel) {
target._handleQueue = null;

queue.forEach(function(args) {
target._send(args.message, args.handle, false);
target._send(args.message, args.handle, false, args.callback);
});

// Process a pending disconnect (if any).
Expand Down Expand Up @@ -478,14 +497,24 @@ function setupChannel(target, channel) {
});
});

target.send = function(message, handle) {
if (!this.connected)
this.emit('error', new Error('channel closed'));
else
this._send(message, handle, false);
target.send = function(message, handle, callback) {
if (typeof handle === 'function') {
callback = handle;
handle = undefined;
}
if (this.connected) {
this._send(message, handle, false, callback);
return;
}
const ex = new Error('channel closed');
if (typeof callback === 'function') {
process.nextTick(callback, ex);
} else {
this.emit('error', ex); // FIXME(bnoordhuis) Defer to next tick.
}
};

target._send = function(message, handle, swallowErrors) {
target._send = function(message, handle, swallowErrors, callback) {
assert(this.connected || this._channel);

if (message === undefined)
Expand Down Expand Up @@ -516,7 +545,11 @@ function setupChannel(target, channel) {

// Queue-up message and handle if we haven't received ACK yet.
if (this._handleQueue) {
this._handleQueue.push({ message: message.msg, handle: handle });
this._handleQueue.push({
callback: callback,
handle: handle,
message: message.msg,
});
return;
}

Expand All @@ -538,24 +571,43 @@ function setupChannel(target, channel) {
} else if (this._handleQueue &&
!(message && message.cmd === 'NODE_HANDLE_ACK')) {
// Queue request anyway to avoid out-of-order messages.
this._handleQueue.push({ message: message, handle: null });
this._handleQueue.push({
callback: callback,
handle: null,
message: message,
});
return;
}

var req = new WriteWrap();
req.oncomplete = nop;
req.async = false;

var string = JSON.stringify(message) + '\n';
var err = channel.writeUtf8String(req, string, handle);

if (err) {
if (!swallowErrors)
this.emit('error', errnoException(err, 'write'));
} else if (handle && !this._handleQueue) {
this._handleQueue = [];
}

if (obj && obj.postSend) {
req.oncomplete = obj.postSend.bind(null, handle);
if (err === 0) {
if (handle && !this._handleQueue)
this._handleQueue = [];
req.oncomplete = function() {
if (this.async === true)
control.unref();
if (obj && obj.postSend)
obj.postSend(handle);
if (typeof callback === 'function')
callback(null);
};
if (req.async === true) {
control.ref();
} else {
process.nextTick(function() { req.oncomplete(); });
}
} else if (!swallowErrors) {
const ex = errnoException(err, 'write');
if (typeof callback === 'function') {
process.nextTick(callback, ex);
} else {
this.emit('error', ex); // FIXME(bnoordhuis) Defer to next tick.
}
}

/* If the master is > 2 read() calls behind, please stop sending. */
Expand Down Expand Up @@ -616,6 +668,7 @@ function setupChannel(target, channel) {
};

channel.readStart();
return control;
}


Expand Down
4 changes: 4 additions & 0 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,10 @@ void Initialize(Handle<Object> target,
target->Set(env->context(),
FIXED_ONE_BYTE_STRING(env->isolate(), "kMaxLength"),
Integer::NewFromUnsigned(env->isolate(), kMaxLength)).FromJust();

target->Set(env->context(),
FIXED_ONE_BYTE_STRING(env->isolate(), "kStringMaxLength"),
Integer::New(env->isolate(), String::kMaxLength)).FromJust();
}


Expand Down
Loading