Skip to content

Commit

Permalink
test: fix flaky test-repl-sigint-nested-eval
Browse files Browse the repository at this point in the history
There is a race condition where process.kill can be sent before the
target is ready to receive the signal. Or at least that's what I think
is going on. Regardless, objectively, using setTimeout() to slightly
delay the invocation causes the test to not fail anymore using:
tools/test.py --repeat=1000 test/parallel/test-repl-sigint-nested-eval

Fixes: #41123
  • Loading branch information
Trott committed Nov 7, 2022
1 parent e1ac4e9 commit 4af389d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Expand Up @@ -5,8 +5,6 @@ prefix parallel
# sample-test : PASS,FLAKY

[true] # This section applies to all platforms
# https://github.com/nodejs/node/issues/41123
test-repl-sigint-nested-eval: PASS, FLAKY
# https://github.com/nodejs/node/issues/43084
test-worker-http2-stream-terminate: PASS, FLAKY

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-sigint-nested-eval.js
Expand Up @@ -23,7 +23,7 @@ child.stdout.on('data', function(c) {

child.stdout.once('data', common.mustCall(() => {
process.on('SIGUSR2', common.mustCall(() => {
process.kill(child.pid, 'SIGINT');
setTimeout(() => { process.kill(child.pid, 'SIGINT'); }, 10);
child.stdout.once('data', common.mustCall(() => {
// Make sure REPL still works.
child.stdin.end('"foobar"\n');
Expand Down

0 comments on commit 4af389d

Please sign in to comment.