From 1dde3ea9481e8a8b62853c568dadeceea3c47d8c Mon Sep 17 00:00:00 2001 From: Matt Loring Date: Tue, 28 Jun 2016 13:56:10 -0700 Subject: [PATCH] benchmark: fix hanging test client-request-body Currently, this benchmark does not close the server it creates and continues sending requests to the server after the benchmark has completed. This causes the benchmark to hang. This change cleans up the server and stops the sending of requests after the benchmark has completed. --- benchmark/http/client-request-body.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/benchmark/http/client-request-body.js b/benchmark/http/client-request-body.js index 8d7fae44c1ebf6..97932d7c615343 100644 --- a/benchmark/http/client-request-body.js +++ b/benchmark/http/client-request-body.js @@ -15,6 +15,7 @@ function main(conf) { var dur = +conf.dur; var len = +conf.bytes; + var running = true; var encoding; var chunk; switch (conf.type) { @@ -52,7 +53,9 @@ function main(conf) { function pummel() { var req = http.request(options, function(res) { nreqs++; - pummel(); // Line up next request. + if (running) { + pummel(); // Line up next request. + } res.resume(); }); if (conf.method === 'write') { @@ -65,5 +68,7 @@ function main(conf) { function done() { bench.end(nreqs); + server.close(); + running = false; } }