-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clerk-js): Prevent memory leak in worker timers setTimeout #4515
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 8912ef3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Thanks!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@BRKalow Anything else I can do here to help this get merged? |
Description
When creating a timeout using worker timers, timeout callback is saved on the page side in map, and a mapping between page-side id and worker-side id is saved in an object in the worker.
Both of these entries are only cleaned up if the timeout is canceled with
clearTimeout
. Normally this isn't done. So even after timeout has fired, related entries are kept, causing a memory leak. It's especially noticeable whensetTimeout
is called recursively, as is done inPoller
used by email link flow.This PR cleans timeout-related entries once the timer has successfully fired.
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change