Skip to content

Commit

Permalink
test: make the vm timeout escape tests more lenient
Browse files Browse the repository at this point in the history
Previously the tests required that Node.js finish the initialization
of the watchdog thread and fires the timeout within 100ms, which
can be difficult on certain systems under load. This patch
relaxes the requirement to 2000ms. If there is a bug and the
timeout can actually be escaped, raising the timeout to 2000ms
would not make a difference anyway.

PR-URL: #44433
Refs: nodejs/reliability#333
Refs: nodejs/reliability#361
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Stephen Belanger <[email protected]>
  • Loading branch information
joyeecheung authored and juanarbol committed Oct 11, 2022
1 parent b5901a0 commit c3429ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-vm-timeout-escape-promise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function loop() {
while (1) {
const current = hrtime();
const span = (current - start) / NS_PER_MS;
if (span >= 100n) {
if (span >= 2000n) {
throw new Error(
`escaped timeout at ${span} milliseconds!`);
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-vm-timeout-escape-promise-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function loop() {
while (1) {
const current = hrtime();
const span = (current - start) / NS_PER_MS;
if (span >= 100n) {
if (span >= 2000n) {
throw new Error(
`escaped timeout at ${span} milliseconds!`);
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-vm-timeout-escape-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function loop() {
while (1) {
const current = hrtime();
const span = (current - start) / NS_PER_MS;
if (span >= 100n) {
if (span >= 2000n) {
throw new Error(
`escaped timeout at ${span} milliseconds!`);
}
Expand Down

0 comments on commit c3429ab

Please sign in to comment.