Skip to content
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

src: refactor weakref cleanup #30198

Closed
wants to merge 1 commit into from

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Oct 31, 2019

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Oct 31, 2019
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Can you explain the motivation here? I feel like this is a step in an odd direction, and I'd still prefer to run these as tasks on an uv_async_t rather than doing so using the miceotask queue or running at the end of the callback scope...


void HostCleanupFinalizationGroupMicrotask(void* data) {
FinalizationGroupCleanupTask* t =
reinterpret_cast<FinalizationGroupCleanupTask*>(data);
Copy link
Member

Choose a reason for hiding this comment

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

Can you use static_cast here?

env->RegisterFinalizationGroupForCleanup(group);
env->isolate()->EnqueueMicrotask(
HostCleanupFinalizationGroupMicrotask,
new FinalizationGroupCleanupTask(env, group));
Copy link
Member

Choose a reason for hiding this comment

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

I think this misses a corresponding delete?

@devsnek
Copy link
Member Author

devsnek commented Oct 31, 2019

@addaleax ClearKeptObjects is in the correct place either way. Why would a uv_async_t be preferable for the finalization cleanup?

@addaleax
Copy link
Member

@devsnek I still think it’s preferable to run these callbacks after GC without an unbounded delay, like whatwg/html#4571 suggests it for HTML.

@addaleax
Copy link
Member

Hm … ping @devsnek? I’m currently running into the “Cannot create a handle without a HandleScope” crash :)

addaleax added a commit to addaleax/node that referenced this pull request Nov 23, 2019
Schedule a task on the main event loop, similar to what the HTML
spec recommends for browsers.

Alternative to nodejs#30198
@addaleax addaleax mentioned this pull request Nov 23, 2019
4 tasks
@devsnek devsnek closed this Nov 23, 2019
@devsnek devsnek deleted the refactor-weak-refs branch November 23, 2019 23:43
addaleax added a commit that referenced this pull request Nov 29, 2019
Schedule a task on the main event loop, similar to what the HTML
spec recommends for browsers.

Alternative to #30198

PR-URL: #30616
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
addaleax added a commit that referenced this pull request Nov 29, 2019
Schedule a task on the main event loop, similar to what the HTML
spec recommends for browsers.

Alternative to #30198

PR-URL: #30616
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit that referenced this pull request Jan 13, 2020
Schedule a task on the main event loop, similar to what the HTML
spec recommends for browsers.

Alternative to #30198

PR-URL: #30616
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Schedule a task on the main event loop, similar to what the HTML
spec recommends for browsers.

Alternative to #30198

PR-URL: #30616
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants