GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — child_process: swallow errors in internal communication by apapirovski · Pull Request #21108 · nodejs/node

child_process: swallow errors in internal communication #21108

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.

Sign up for GitHub

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

Closed
apapirovski wants to merge 3 commits into nodejs:master from apapirovski:fix-socket-list-epipe

Uh oh!

There was an error while loading. Please reload this page.

Closed

child_process: swallow errors in internal communication #21108

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
0d17569
child_process: swallow errors in internal communication
apapirovski Jun 3, 2018
086ab4e
fixup: remove from flaky
apapirovski Jun 3, 2018
c37af92
fixup: param order
apapirovski Jun 5, 2018
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

14 changes: 7 additions & 7 deletions 14 lib/internal/socket_list.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class SocketListSend extends EventEmitter {
child.once('exit', () => this.emit('exit', this));
}

_request(msg, cmd, callback) {
_request(msg, cmd, swallowErrors, callback) {
var self = this;

if (!this.child.connected) return onclose();
this.child.send(msg);
this.child._send(msg, undefined, swallowErrors);

function onclose() {
self.child.removeListener('internalMessage', onreply);
Expand All @@ -40,14 +40,14 @@ class SocketListSend extends EventEmitter {
this._request({
cmd: 'NODE_SOCKET_NOTIFY_CLOSE',
key: this.key
}, 'NODE_SOCKET_ALL_CLOSED', callback);
}, 'NODE_SOCKET_ALL_CLOSED', true, callback);
}

getConnections(callback) {
this._request({
cmd: 'NODE_SOCKET_GET_COUNT',
key: this.key
}, 'NODE_SOCKET_COUNT', function(err, msg) {
}, 'NODE_SOCKET_COUNT', false, function(err, msg) {
if (err) return callback(err);
callback(null, msg.count);
});
Expand All @@ -67,10 +67,10 @@ class SocketListReceive extends EventEmitter {
function onempty(self) {
if (!self.child.connected) return;

self.child.send({
self.child._send({
cmd: 'NODE_SOCKET_ALL_CLOSED',
key: self.key
});
}, undefined, true);
}

this.child.on('internalMessage', (msg) => {
Expand All @@ -84,7 +84,7 @@ class SocketListReceive extends EventEmitter {
this.once('empty', onempty);
} else if (msg.cmd === 'NODE_SOCKET_GET_COUNT') {
if (!this.child.connected) return;
this.child.send({
this.child._send({
cmd: 'NODE_SOCKET_COUNT',
key: this.key,
count: this.connections
Expand Down
1 change: 0 additions & 1 deletion 1 test/parallel/parallel.status
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ prefix parallel
test-postmortem-metadata: PASS,FLAKY

[$system==win32]
test-child-process-fork-net-socket: PASS,FLAKY

[$system==linux]

Expand Down
6 changes: 3 additions & 3 deletions 6 test/parallel/test-internal-socket-list-receive.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: false,
send: common.mustNotCall()
_send: common.mustNotCall()
});

const list = new SocketListReceive(child, key);
Expand All @@ -24,7 +24,7 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: true,
send: common.mustCall((msg) => {
_send: common.mustCall((msg) => {
assert.strictEqual(msg.cmd, 'NODE_SOCKET_ALL_CLOSED');
assert.strictEqual(msg.key, key);
})
Expand All @@ -38,7 +38,7 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: true,
send: common.mustCall((msg) => {
_send: common.mustCall((msg) => {
assert.strictEqual(msg.cmd, 'NODE_SOCKET_COUNT');
assert.strictEqual(msg.key, key);
assert.strictEqual(msg.count, 0);
Expand Down
16 changes: 8 additions & 8 deletions 16 test/parallel/test-internal-socket-list-send.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const key = 'test-key';

const list = new SocketListSend(child, 'test');

list._request('msg', 'cmd', common.mustCall((err) => {
list._request('msg', 'cmd', false, common.mustCall((err) => {
common.expectsError({
code: 'ERR_CHILD_CLOSED_BEFORE_REPLY',
type: Error,
Expand All @@ -30,7 +30,7 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: true,
send: function(msg) {
_send: function(msg) {
process.nextTick(() =>
this.emit('internalMessage', { key, cmd: 'cmd' })
);
Expand All @@ -39,7 +39,7 @@ const key = 'test-key';

const list = new SocketListSend(child, key);

list._request('msg', 'cmd', common.mustCall((err, msg) => {
list._request('msg', 'cmd', false, common.mustCall((err, msg) => {
assert.strictEqual(err, null);
assert.strictEqual(msg.cmd, 'cmd');
assert.strictEqual(msg.key, key);
Expand All @@ -53,12 +53,12 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: true,
send: function(msg) { process.nextTick(() => this.emit('disconnect')); }
_send: function(msg) { process.nextTick(() => this.emit('disconnect')); }
});

const list = new SocketListSend(child, key);

list._request('msg', 'cmd', common.mustCall((err) => {
list._request('msg', 'cmd', false, common.mustCall((err) => {
common.expectsError({
code: 'ERR_CHILD_CLOSED_BEFORE_REPLY',
type: Error,
Expand All @@ -73,7 +73,7 @@ const key = 'test-key';
{
const child = Object.assign(new EventEmitter(), {
connected: true,
send: function(msg) {
_send: function(msg) {
assert.strictEqual(msg.cmd, 'NODE_SOCKET_NOTIFY_CLOSE');
assert.strictEqual(msg.key, key);
process.nextTick(() =>
Expand All @@ -98,7 +98,7 @@ const key = 'test-key';
const count = 1;
const child = Object.assign(new EventEmitter(), {
connected: true,
send: function(msg) {
_send: function(msg) {
assert.strictEqual(msg.cmd, 'NODE_SOCKET_GET_COUNT');
assert.strictEqual(msg.key, key);
process.nextTick(() =>
Expand Down Expand Up @@ -127,7 +127,7 @@ const key = 'test-key';
const count = 1;
const child = Object.assign(new EventEmitter(), {
connected: true,
send: function() {
_send: function() {
process.nextTick(() => {
this.emit('disconnect');
this.emit('internalMessage', { key, count, cmd: 'NODE_SOCKET_COUNT' });
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.