René's URL Explorer Experiment


Title: FakeAsyncZone and RootZone used in conjunction can clobber interleaved timers of each other · Issue #54323 · angular/angular · GitHub

Open Graph Title: FakeAsyncZone and RootZone used in conjunction can clobber interleaved timers of each other · Issue #54323 · angular/angular

X Title: FakeAsyncZone and RootZone used in conjunction can clobber interleaved timers of each other · Issue #54323 · angular/angular

Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? Yes Description Currently, Zone.js patches setTimeout and keeps a tasksByHandleId map to keep a timerId <-> ZoneTask relationship. This map appears to b...

Open Graph Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? Yes Description Currently, Zone.js patches setTimeout and keeps a tasksByHandleId map to keep a timerId <-> Zone...

X Description: Which @angular/* package(s) are the source of the bug? zone.js Is this a regression? Yes Description Currently, Zone.js patches setTimeout and keeps a tasksByHandleId map to keep a timerId <->...

Opengraph URL: https://github.com/angular/angular/issues/54323

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FakeAsyncZone and RootZone used in conjunction can clobber interleaved timers of each other","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nzone.js\n\n### Is this a regression?\n\nYes\n\n### Description\n\nCurrently, Zone.js patches `setTimeout` and keeps a `tasksByHandleId` map to keep a `timerId` \u003c-> `ZoneTask`\r\nrelationship. This map appears to be _global_ to each method per `window` (browser use case) / `global` instance and not per `Zone` as it's defined on `patchTimer`.\r\n\r\nTasks then use the return value from their schedule methods (such as `setTimeout`) to store this ID in `tasksByHandleId`. For example, in the case of a root zone with no wrapping it normally just calls\r\n`setNative` which may invoke `setTimeout` and we store the timer ID in the map. These IDs are monotonically increasing and therefore are never reused. However, in the case of [`fake-async-test`](https://github.com/angular/angular/blob/main/packages/zone.js/lib/zone-spec/fake-async-test.ts#L69) it starts from `1` and increments it's own counters per task. \r\n\r\nIf you have a `Zone` that is using `setNative` and scheduling using the real browser scheduler and using `fake-async-zone` it is possible to generate two tasks that are both pending with the same ID because they don't know of each other. For example:\r\n\r\n```\r\nlet oldTimerId = \r\nrunInFakeAsyncZone(() => {\r\n  // Run a timer in such a way that it also returns the same timer ID\r\n  // but does not resolve, thus overwriting the taskMap\r\n  // Maybe it wasn't fired from an even and has to be flushed or something\r\n  oldTimerId = ...\r\n});\r\n\r\n// Run in \u003croot>, running later\r\n// timerId == oldTimerId now\r\n// Therefore, `tasksByHandleId` is overwritten to use this ID\r\nlet timerId = setTimeout(() => console.log('I should run but never do'), 30000);\r\n\r\n\r\nrunInFakeAsyncZone(() => {\r\n  // We changed our mind, cancel the timer \r\n  clearInterval(oldTimerId)\r\n\r\n  // Actually, they shared an ID and `tasksByHandleId` was updated\r\n  // to point to the \u003croot> task so `task.zone.cancelTask(task)` is invoked\r\n  // but the implementation uses `clearNative` and clears the \u003croot> task\r\n  // meaning that the setTimeout never runs\r\n});\r\n```\r\n\r\nIn the above psuedo-code, the task that runs in some other zone is overwritten with one that runs the `root` later because of the shared map. In contexts outside of `fake-async-test`, it's likely never going to happen\r\nbecause the IDs are strictly monotonically increasing. But in `fake-async-test`, this is troublesome because they can overlap which is bad news when using a single global `tasksByHandleId`\r\n\r\nSome thoughts:\r\n\r\n1. I don't know if this use case is that common but it's at least common in a couple of Google tests that trigger this behaviour\r\n2. If overlap is not expected, the task map should probably assert and break early because this was a _huge pain_ to track down as not only is timing sensitive but it's also a read / write race\r\n3. If overlap is expected in some cases, we need to somehow handle this\r\n\r\nI've not included a full reproduction yet because the exact specifics are kind of hard to encode but I will try and get something up.\n\n### Please provide a link to a minimal reproduction of the bug\n\nN/A; coming soon maybe\n\n### Please provide the exception or error you saw\n\n_No response_\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular: HEAD\n```\n\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/hilts-vaughan","@type":"Person","name":"hilts-vaughan"},"datePublished":"2024-02-07T20:42:06Z","url":"https://github.com/angular/angular/issues/54323"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0f183a21-b3d8-9104-2a76-26ba97e5f089
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEB7E:62F48:A33258:D7F219:6B01EBF0
html-safe-nonce5b6012c36ff08c15710ac21b68d2d743f58e7276bc54ba90a4603913921a8679
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjdFOjYyRjQ4OkEzMzI1ODpEN0YyMTk6NkIwMUVCRjAiLCJ2aXNpdG9yX2lkIjoiNjY3Njg4NDI0NTIyNDQ4MzgyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacabcbc9b4c23346928b4ddb9a355e8a02b1a0a12ca4f33fd1da57a9c17e866431
hovercard-subject-tagissue:2123848890
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/54323/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8398ed085b7640ff0fb0c835d79693793925a95071b2587defbe1a1452768578/angular/angular/issues/54323
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8398ed085b7640ff0fb0c835d79693793925a95071b2587defbe1a1452768578/angular/angular/issues/54323
og:image:altWhich @angular/* package(s) are the source of the bug? zone.js Is this a regression? Yes Description Currently, Zone.js patches setTimeout and keeps a tasksByHandleId map to keep a timerId <-> Zone...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehilts-vaughan
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/54323#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F54323
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F54323
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/54323
Reloadhttps://github.com/angular/angular/issues/54323
Reloadhttps://github.com/angular/angular/issues/54323
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests142 (142)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/54323
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/54323
FakeAsyncZone and RootZone used in conjunction can clobber interleaved timers of each otherhttps://github.com/angular/angular/issues/54323#top
https://github.com/JiaLiPassion
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/hilts-vaughan
hilts-vaughanhttps://github.com/hilts-vaughan
on Feb 7, 2024https://github.com/angular/angular/issues/54323#issue-2123848890
fake-async-testhttps://github.com/angular/angular/blob/main/packages/zone.js/lib/zone-spec/fake-async-test.ts#L69
JoostKhttps://github.com/JoostK
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
on Feb 7, 2024https://github.com/angular/angular/issues/54323#event-11737602274
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Feb 7, 2024https://github.com/angular/angular/issues/54323#event-11737602596
JiaLiPassionhttps://github.com/JiaLiPassion
on Feb 8, 2024https://github.com/angular/angular/issues/54323#event-11752271945
dylhunnhttps://github.com/dylhunn
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
ddbf6bbhttps://github.com/angular/angular/commit/ddbf6bb038d101daf5280abbd2a0efaa0b7fd3a0
on Mar 28, 2024https://github.com/angular/angular/issues/54323#event-12285139921
nikos-moysiadishttps://github.com/nikos-moysiadis
on Mar 28, 2024https://github.com/angular/angular/issues/54323#event-12285187920
fix(zone.js): make sure fakeasync use the same id pool with native (a…https://github.com/nikos-moysiadis/angular/commit/ddbf6bb038d101daf5280abbd2a0efaa0b7fd3a0
a…https://github.com/angular/angular/pull/54600
https://docs.github.com/articles/closing-issues-via-commit-messages
ddbf6bbhttps://github.com/nikos-moysiadis/angular/commit/ddbf6bb038d101daf5280abbd2a0efaa0b7fd3a0
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Apr 28, 2024https://github.com/angular/angular/issues/54323#issuecomment-2081258294
automatic conversation locking policyhttps://github.com/angular/angular/blob/8f24bc9443b3872fe095d9f7f77b308a361a13b4/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Apr 28, 2024https://github.com/angular/angular/issues/54323#event-12633408270
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/54323
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/54323
JiaLiPassionhttps://github.com/JiaLiPassion
area: zonesIssues related to zone.jshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20zones%22
needsTriageNo due datehttps://github.com/angular/angular/milestone/83
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.