Skip to content

Commit 261eb67

Browse files
Etienne Pierre-doraybmeck
Etienne Pierre-doray
authored andcommitted
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: nodejs#53292 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 7746a86 commit 261eb67

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

+3-2
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)