-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
async_wrap: clear destroy_ids vector #10400
Conversation
All failing AIX tests not related to this change. |
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.
Left a suggestion but LGTM either way.
@@ -212,6 +212,8 @@ void AsyncWrap::DestroyIdsCb(uv_idle_t* handle) { | |||
FatalException(env->isolate(), try_catch); | |||
} | |||
} | |||
|
|||
env->destroy_ids_list()->clear(); |
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.
Can I suggest you swap before iteration? I.e.:
std::vector<int64_t> destroy_ids_list;
destroy_ids_list.swap(*env->destroy_ids_list());
for (auto current_id : destroy_ids_list) {
// ...
}
That way the list is both cleared and immune to concurrent modification by the callback.
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.
done
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.
LGTM with Ben’s suggestion
19b54ae
to
dd49d82
Compare
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: nodejs#10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
dd49d82
to
833294f
Compare
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: #10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Thank you. Merged, and landed on v7.x-staging in 81a6dd5. @thealphanerd This should land in v6.x before the next release, if possible. I'll wait until this lands on v6, then prep both this and #9174 for v4. |
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: #10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: #10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
@trevnorris this has been backported to v6.x and will be in the next release |
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: #10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
After processing all the callbacks in the destroy_ids vector make sure to clear() it otherwise the DestroyIdsCb() won't run again. PR-URL: #10400 Fixes: b49b496 "async_wrap: call destroy() callback in uv_idle_t" Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
async_wrap
Description of change
After processing all the callbacks in the destroy_ids vector make sure
to clear() it otherwise the DestroyIdsCb() won't run again.
This patch should land on all releases that have b49b496, or some cherry-pick of it.
CI: https://ci.nodejs.org/job/node-test-commit/6782/