Skip to content

Commit

Permalink
inspector: Use default uv_listen backlog size
Browse files Browse the repository at this point in the history
PR-URL: #20254
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Eugene Ostroukhov authored and MylesBorins committed May 4, 2018
1 parent b5c1c14 commit 375994f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/inspector_socket_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ int ServerSocket::Listen(InspectorSocketServer* inspector_server,
CHECK_EQ(0, uv_tcp_init(loop, server));
int err = uv_tcp_bind(server, addr, 0);
if (err == 0) {
err = uv_listen(reinterpret_cast<uv_stream_t*>(server), 1,
// 511 is the value used by a 'net' module by default
err = uv_listen(reinterpret_cast<uv_stream_t*>(server), 511,
ServerSocket::SocketConnectedCallback);
}
if (err == 0) {
Expand Down
34 changes: 34 additions & 0 deletions test/parallel/test-inspector-stress-http.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Flags: --expose-internals
'use strict';
const common = require('../common');

common.skipIfInspectorDisabled();

const assert = require('assert');
const { NodeInstance } = require('../common/inspector-helper.js');

async function testHttp(child, number) {
try {
await child.httpGet(null, '/json/list');
return true;
} catch (e) {
console.error(`Attempt ${number} failed`, e);
return false;
}
}

async function runTest() {
const child = new NodeInstance(undefined, '');

const promises = [];
for (let i = 0; i < 100; i++) {
promises.push(testHttp(child, i));
}
const result = await Promise.all(promises);
assert(!result.some((a) => !a), 'Some attempts failed');
return child.kill();
}

common.crashOnUnhandledRejection();

runTest();

0 comments on commit 375994f

Please sign in to comment.