Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 275907f

Browse filesBrowse files
apapirovskiMylesBorins
authored andcommitted
test: fix flaky http2-session-unref
It's possible for the connections to take too long and since the server is already unrefed, the process will just exit. Instead adjust the test so that server unref only happens after all sessions have been successfuly established and unrefed. That still tests the same condition but will not fail under load. PR-URL: #20772 Fixes: #20705 Fixes: #20750 Fixes: #20850 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 171600d commit 275907f
Copy full SHA for 275907f

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http2-session-unref.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-session-unref.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@ const common = require('../common');
99
if (!common.hasCrypto)
1010
common.skip('missing crypto');
1111
const http2 = require('http2');
12+
const Countdown = require('../common/countdown');
1213
const makeDuplexPair = require('../common/duplexpair');
1314

1415
const server = http2.createServer();
1516
const { clientSide, serverSide } = makeDuplexPair();
1617

18+
const counter = new Countdown(3, () => server.unref());
19+
1720
// 'session' event should be emitted 3 times:
1821
// - the vanilla client
1922
// - the destroyed client
2023
// - manual 'connection' event emission with generic Duplex stream
2124
server.on('session', common.mustCallAtLeast((session) => {
25+
counter.dec();
2226
session.unref();
2327
}, 3));
2428

@@ -54,4 +58,3 @@ server.listen(0, common.mustCall(() => {
5458
}
5559
}));
5660
server.emit('connection', serverSide);
57-
server.unref();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.