Skip to content

fix: drop queued UvRunOnce tasks when polling stops - #56061

Open
kmamal wants to merge 3 commits into
electron:mainfrom
kmamal:fix/stale-uv-run-once-after-stop-polling
Open

kmamal wants to merge 3 commits into
electron:mainfrom
kmamal:fix/stale-uv-run-once-after-stop-polling

Conversation

@kmamal

@kmamal kmamal commented Nov 25, 2026 •

Copy link
Copy Markdown

Description of Change

Fixes #56060.

UvRunOnce tasks now carry the polling generation they were posted under, and StopPolling() bumps it, as in #54228.
A task from before the stop returns without running the loop or posting embed_sem_, so it cannot disturb the next page's embed thread.

I have not built or run this version, and I don't have a machine that can build electron.
I tested that one by patching it into the 45.5.0 release binary: with 5 ms busy work, 0 of 160 reloads stalled, against 76 of 160 without it.

The first version of this PR invalidated the weak pointers in StopPolling() instead.

Checklist

Release Notes

Notes: Fixed Node.js timers in the renderer stopping after a page reload.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This PR contains unsigned commits. This repository enforces commit signatures
for all incoming PRs. To get your PR merged, please sign those commits
(git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch
(git push --force-with-lease)

For more information on signing commits, see GitHub's documentation on Telling Git about your signing key.

@github-actions github-actions Bot added the needs-signed-commits Currently some or all of the commits in this PR are not signed label Nov 25, 2026
@kmamal
kmamal force-pushed the fix/stale-uv-run-once-after-stop-polling branch from d2a5f09 to 51807d9 Compare November 25, 2026 10:49
@github-actions github-actions Bot removed the needs-signed-commits Currently some or all of the commits in this PR are not signed label Nov 25, 2026
@deepak1556

Copy link
Copy Markdown
Member

Thanks for working on this, can you instead taking the poll tracking bit from eaa0990 polling_generation_ which should cleanly stop old queued tasks from running after page reload and also avoid re-entrant cases. This will also supersede well when the refactor lands.

cc @codebytere

@kmamal

kmamal commented Nov 26, 2026

Copy link
Copy Markdown
Author

I have updated the PR based on eaa0990

@deepak1556

Copy link
Copy Markdown
Member

Can you mark the PR ready for us to review.

@deepak1556 deepak1556 added semver/patch backwards-compatible bug fixes target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. target/46-x-y PR should also be added to the "46-x-y" branch. labels Nov 27, 2026
@kmamal
kmamal marked this pull request as ready for review November 27, 2026 08:21
@kmamal

kmamal commented Nov 27, 2026

Copy link
Copy Markdown
Author

marked ready

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/patch backwards-compatible bug fixes target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. target/46-x-y PR should also be added to the "46-x-y" branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Node.js timers in the renderer stop firing after a page reload

2 participants