GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_runner: Fix mock timer issues by mika-fischer · Pull Request #50384 · nodejs/node

Conversation

@mika-fischer

@mika-fischer mika-fischer commented Oct 25, 2023

Copy link
Copy Markdown
Contributor

There were various issues in the mock timer implementation causing deviations from expected behavior. This adds tests and fixes these issues. See the issues below for details:

Fixes: #50365
Fixes: #50381
Fixes: #50382

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and ErickWendel reacted with heart emoji
All reactions
  • ❤️ 2 reactions
mika-fischer added 4 commits October 25, 2023 12:12
@mika-fischer
test_runner: add tests for various mock timer issues
1a23be5
@mika-fischer
test_runner: fix tick processing terminating prematurely
c087b39
An incorrect early return caused processing of due timers to stop
prematurely.

Fixes: nodejs#50382
@mika-fischer
test_runner: fix mocked setInterval using the wrong interval
73ec104
mocked setInterval used the wrong increment when scheduling the new
timer.

Fixes: nodejs#50382
@mika-fischer
test_runner: fix incorrect cleanup of timers
22fbdd3
Removal of mocket timers from the priority queue was broken. It used the
timerId instead of the position in the queue as index. This lead to
removal of incorrect timers from the queue causing timers not to be
scheduled at all.

Also, aborts caused removal from the queue even when the timer was
already triggered, and thus no longer present in the queue.

Fixes: nodejs#50365
@nodejs-github-bot

nodejs-github-bot commented Oct 25, 2023 •
edited by rluvaton
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Oct 25, 2023
@mika-fischer mika-fischer changed the title Fix mock timer issues test_runner: Fix mock timer issues Oct 25, 2023
benjamingr
benjamingr approved these changes Oct 25, 2023
View reviewed changes

@benjamingr benjamingr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mika-fischer reacted with heart emoji
All reactions
  • ❤️ 1 reaction
atlowChemi
atlowChemi approved these changes Oct 26, 2023
View reviewed changes
@atlowChemi atlowChemi added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 26, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 26, 2023
@nodejs-github-bot

nodejs-github-bot commented Oct 26, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/55245/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rluvaton
rluvaton reviewed Oct 26, 2023
View reviewed changes
Comment thread test/parallel/test-runner-mock-timers.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mika-fischer @rluvaton
Update test/parallel/test-runner-mock-timers.js
1f91c1f
Co-authored-by: Raz Luvaton <[email protected]>
anonrig
anonrig reviewed Oct 27, 2023
View reviewed changes
Comment thread test/parallel/test-runner-mock-timers.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Oct 28, 2023
View reviewed changes
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 31, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 31, 2023
@nodejs-github-bot

nodejs-github-bot commented Oct 31, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/55352/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 1, 2023
CI Reliability 2023-11-01 nodejs/reliability#704
Open
CI Reliability 2023-11-02 nodejs/reliability#705
Open
@mika-fischer

mika-fischer commented Nov 2, 2023

Copy link
Copy Markdown
Contributor Author

Anything I can do to move this along?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 2, 2023 •
edited by jasnell
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/55423/ 💛

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 3, 2023
CI Reliability 2023-11-03 nodejs/reliability#706
Open
CI Reliability 2023-11-04 nodejs/reliability#707
Open
CI Reliability 2023-11-05 nodejs/reliability#708
Open
@jasnell jasnell added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 11, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 11, 2023
@nodejs-github-bot nodejs-github-bot added the commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. label Nov 11, 2023
@nodejs-github-bot

nodejs-github-bot commented Nov 11, 2023

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/50384
✔  Done loading data for nodejs/node/pull/50384
----------------------------------- PR info ------------------------------------
Title      test_runner: Fix mock timer issues (#50384)
Author     Mika Fischer  (@mika-fischer)
Branch     mika-fischer:fix-mock-timer-issues -> nodejs:main
Labels     author ready, needs-ci, test_runner
Commits    5
 - test_runner: add tests for various mock timer issues
 - test_runner: fix tick processing terminating prematurely
 - test_runner: fix mocked setInterval using the wrong interval
 - test_runner: fix incorrect cleanup of timers
 - Update test/parallel/test-runner-mock-timers.js
Committers 2
 - Mika Fischer 
 - GitHub 
PR-URL: https://github.com/nodejs/node/pull/50384
Fixes: https://github.com/nodejs/node/issues/50365
Fixes: https://github.com/nodejs/node/issues/50381
Fixes: https://github.com/nodejs/node/issues/50382
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: Chemi Atlow 
Reviewed-By: James M Snell 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/50384
Fixes: https://github.com/nodejs/node/issues/50365
Fixes: https://github.com/nodejs/node/issues/50381
Fixes: https://github.com/nodejs/node/issues/50382
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: Chemi Atlow 
Reviewed-By: James M Snell 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 25 Oct 2023 10:13:19 GMT
   ✔  Approvals: 3
   ✔  - Benjamin Gruenbaum (@benjamingr) (TSC): https://github.com/nodejs/node/pull/50384#pullrequestreview-1698099014
   ✔  - Chemi Atlow (@atlowChemi): https://github.com/nodejs/node/pull/50384#pullrequestreview-1698665528
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/50384#pullrequestreview-1702811208
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2023-11-02T13:56:29Z: https://ci.nodejs.org/job/node-test-pull-request/55423/
- Querying data for job/node-test-pull-request/55423/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
   6b27f5b09e..83e6350b82  main       -> origin/main
✔  origin/main is now up-to-date
main is out of sync with origin/main. Mismatched commits:
 - 73aab9193b errors: improve hideStackFrames
 - 83e6350b82 errors: improve hideStackFrames
--------------------------------------------------------------------------------
HEAD is now at 83e6350b82 errors: improve hideStackFrames
   ✔  Reset to origin/main
- Downloading patch for 50384
From https://github.com/nodejs/node
 * branch                  refs/pull/50384/merge -> FETCH_HEAD
✔  Fetched commits as 83e6350b826a..1f91c1fed83b
--------------------------------------------------------------------------------
Auto-merging test/parallel/test-runner-mock-timers.js
[main fe61727cef] test_runner: add tests for various mock timer issues
 Author: Mika Fischer 
 Date: Wed Oct 25 10:50:11 2023 +0200
 1 file changed, 85 insertions(+)
[main 3fe95d485e] test_runner: fix tick processing terminating prematurely
 Author: Mika Fischer 
 Date: Tue Oct 24 19:46:03 2023 +0200
 1 file changed, 1 deletion(-)
[main 3ecafa459c] test_runner: fix mocked setInterval using the wrong interval
 Author: Mika Fischer 
 Date: Tue Oct 24 19:47:47 2023 +0200
 1 file changed, 2 insertions(+), 2 deletions(-)
[main 5c4a7c7d38] test_runner: fix incorrect cleanup of timers
 Author: Mika Fischer 
 Date: Wed Oct 25 09:52:39 2023 +0200
 1 file changed, 14 insertions(+), 10 deletions(-)
Auto-merging test/parallel/test-runner-mock-timers.js
[main a95c9d8fef] Update test/parallel/test-runner-mock-timers.js
 Author: Mika Fischer 
 Date: Fri Oct 27 10:15:21 2023 +0200
 1 file changed, 1 insertion(+), 1 deletion(-)
   ✔  Patches applied
There are 5 commits in the PR. Attempting autorebase.
Rebasing (2/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test_runner: add tests for various mock timer issues

PR-URL: #50384
Fixes: #50365
Fixes: #50381
Fixes: #50382
Reviewed-By: Benjamin Gruenbaum [email protected]
Reviewed-By: Chemi Atlow [email protected]
Reviewed-By: James M Snell [email protected]

[detached HEAD 83a9752d6b] test_runner: add tests for various mock timer issues
Author: Mika Fischer [email protected]
Date: Wed Oct 25 10:50:11 2023 +0200
1 file changed, 85 insertions(+)
Rebasing (3/10)
Rebasing (4/10)

Executing: git node land --amend --yes
⚠ Found Fixes: #50382, skipping..
--------------------------------- New Message ----------------------------------
test_runner: fix tick processing terminating prematurely

An incorrect early return caused processing of due timers to stop
prematurely.

Fixes: #50382
PR-URL: #50384
Fixes: #50365
Fixes: #50381
Reviewed-By: Benjamin Gruenbaum [email protected]
Reviewed-By: Chemi Atlow [email protected]
Reviewed-By: James M Snell [email protected]

[detached HEAD 01708bf8db] test_runner: fix tick processing terminating prematurely
Author: Mika Fischer [email protected]
Date: Tue Oct 24 19:46:03 2023 +0200
1 file changed, 1 deletion(-)
Rebasing (5/10)
Rebasing (6/10)

Executing: git node land --amend --yes
⚠ Found Fixes: #50382, skipping..
--------------------------------- New Message ----------------------------------
test_runner: fix mocked setInterval using the wrong interval

mocked setInterval used the wrong increment when scheduling the new
timer.

Fixes: #50382
PR-URL: #50384
Fixes: #50365
Fixes: #50381
Reviewed-By: Benjamin Gruenbaum [email protected]
Reviewed-By: Chemi Atlow [email protected]
Reviewed-By: James M Snell [email protected]

[detached HEAD 0518b2218e] test_runner: fix mocked setInterval using the wrong interval
Author: Mika Fischer [email protected]
Date: Tue Oct 24 19:47:47 2023 +0200
1 file changed, 2 insertions(+), 2 deletions(-)
Rebasing (7/10)
Rebasing (8/10)

Executing: git node land --amend --yes
⚠ Found Fixes: #50365, skipping..
--------------------------------- New Message ----------------------------------
test_runner: fix incorrect cleanup of timers

Removal of mocket timers from the priority queue was broken. It used the
timerId instead of the position in the queue as index. This lead to
removal of incorrect timers from the queue causing timers not to be
scheduled at all.

Also, aborts caused removal from the queue even when the timer was
already triggered, and thus no longer present in the queue.

Fixes: #50365
PR-URL: #50384
Fixes: #50381
Fixes: #50382
Reviewed-By: Benjamin Gruenbaum [email protected]
Reviewed-By: Chemi Atlow [email protected]
Reviewed-By: James M Snell [email protected]

[detached HEAD 5aff931d9b] test_runner: fix incorrect cleanup of timers
Author: Mika Fischer [email protected]
Date: Wed Oct 25 09:52:39 2023 +0200
1 file changed, 14 insertions(+), 10 deletions(-)
Rebasing (9/10)
Rebasing (10/10)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
Update test/parallel/test-runner-mock-timers.js

Co-authored-by: Raz Luvaton [email protected]
PR-URL: #50384
Fixes: #50365
Fixes: #50381
Fixes: #50382
Reviewed-By: Benjamin Gruenbaum [email protected]
Reviewed-By: Chemi Atlow [email protected]
Reviewed-By: James M Snell [email protected]

[detached HEAD 89e6a5b6d8] Update test/parallel/test-runner-mock-timers.js
Author: Mika Fischer [email protected]
Date: Fri Oct 27 10:15:21 2023 +0200
1 file changed, 1 insertion(+), 1 deletion(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/6835327454

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atlowChemi atlowChemi added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Nov 12, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 12, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 314c8f9 into nodejs:main Nov 12, 2023
@nodejs-github-bot

nodejs-github-bot commented Nov 12, 2023

Copy link
Copy Markdown
Collaborator

Landed in 314c8f9

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Nov 23, 2023
@mika-fischer @targos
test_runner: add tests for various mock timer issues
0bd694a
PR-URL: #50384
Fixes: #50365
Fixes: #50381
Fixes: #50382
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Nov 28, 2023
v21.3.0 proposal #50954
Merged
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
@mika-fischer @UlisesGascon
test_runner: add tests for various mock timer issues
9830ae4
PR-URL: #50384
Fixes: #50365
Fixes: #50381
Fixes: #50382
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Dec 12, 2023
v20.11.0 proposal #51124
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@anonrig anonrig anonrig left review comments
@rluvaton rluvaton rluvaton left review comments
@jasnell jasnell jasnell approved these changes
@benjamingr benjamingr benjamingr approved these changes
@atlowChemi atlowChemi atlowChemi approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

test_runner: triggered mocked setInterval stops processing of other timers that are due test_runner: mock setInterval uses wrong interval after first time test_runner: mock timer promisified setTimeout cleanup goes wrong losing some timers

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@mika-fischer @nodejs-github-bot @jasnell @benjamingr @anonrig @rluvaton @atlowChemi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.