Skip to content

Commit 2dea6a4

Browse files
test: fix test-http-server-keepalive-req-gc
This changes adds a second explicit gc call in the test. Without this call, the test relies on gc eventually happening based, since the first call doesn't free the object. Relying on gc to eventually happen prevents changing GC heuristics unrelated to this test. The gc call is async; otherwise doing multiple sync GCs doesn't free the object. PR-URL: #53292 Reviewed-By: Luigi Pinca <[email protected]>
1 parent db09f62 commit 2dea6a4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/parallel/test-http-server-keepalive-req-gc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ const server = createServer(common.mustCall((req, res) => {
1414
onGC(req, { ongc: common.mustCall(() => { server.close(); }) });
1515
req.resume();
1616
req.on('end', common.mustCall(() => {
17-
setImmediate(() => {
17+
setImmediate(async () => {
1818
client.end();
19-
global.gc();
19+
await global.gc({ type: 'major', execution: 'async' });
20+
await global.gc({ type: 'major', execution: 'async' });
2021
});
2122
}));
2223
res.end('hello world');

0 commit comments

Comments
 (0)