-
Notifications
You must be signed in to change notification settings - Fork 30k
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
handle_wrap: IsRefed -> Unrefed, no isAlive check #6204
handle_wrap: IsRefed -> Unrefed, no isAlive check #6204
Conversation
LGTM if @trevnorris and CI are happy |
Awkward names, both the old and the new one. What about |
@bnoordhuis Yeah, but Maybe |
HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); | ||
|
||
bool refed = IsAlive(wrap) && (wrap->flags_ & kUnref) == 0; |
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.
There's no message body explaining why you removed the IsAlive()
check, so i'm not sure of your rational. Seeing checks removed without explanation make me quiver.
@trevnorris I put it into the post comment:
|
@Fishrock123 would you mind putting that into the commit message body? i'm lazy and don't want to have to go look at the PR to find out why a change was made. |
Will do. |
Helps in implementation of nodejs#6204, where some options passed to `createSecurePair()` are ignored before this patch. These options are very helpful if someone wants to pass `options.servername` or `options.SNICallback` to securepair. PR-URL: nodejs#2441 Reviewed-By: Fedor Indutny <fedor@indutny.com>
Helps in implementation of nodejs#6204, where some options passed to `createSecurePair()` are ignored before this patch. These options are very helpful if someone wants to pass `options.servername` or `options.SNICallback` to securepair. PR-URL: nodejs#2441 Reviewed-By: Fedor Indutny <fedor@indutny.com>
ping @Fishrock123 ... if you still want this in v6 it needs to be wrapped up by tomorrow morning. |
LGTM, IF the additional information requested above is added to the git message body. |
f97bd23
to
4eb91b0
Compare
This fixes my perceived usability issues with 7d8882b. Which, at the time of writing, has not landed in any release except v6 RCs. This should not be considered a breaking change due to that. It is useful if you have a handle, even if it has been closed, to be able to inspect whether that handle was unrefed or not. As such, this renames the method accordingly. If people need to check a handle's aliveness, that is a separate API we should consider exposing. Refs: nodejs#5834 PR-URL: nodejs#6204 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
4eb91b0
to
9bb5a5e
Compare
Updated with description and metadata. CI before landing: https://ci.nodejs.org/job/node-test-pull-request/2392/ |
plinux failure looks like a flake: |
Man I'm just having terrible luck with this one. This patch attempting to use this feature crashes
diff --git a/lib/timers.js b/lib/timers.js
index dc2506e..9fb247c 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -133,8 +133,6 @@ function insert(item, unrefed) {
list = new TimersList(msecs, unrefed);
L.init(list);
list._timer._list = list;
-
- if (unrefed === true) list._timer.unref();
list._timer.start(msecs, 0);
lists[msecs] = list;
@@ -149,7 +147,7 @@ function TimersList(msecs, unrefed) {
this._idleNext = null; // Create the list with the linkedlist properties to
this._idlePrev = null; // prevent any unnecessary hidden class changes.
this._timer = new TimerWrap();
- this._unrefed = unrefed;
+ if (unrefed === true) this._timer.unref();
this.msecs = msecs;
}
@@ -207,7 +205,7 @@ function listOnTimeout() {
debug('%d list empty', msecs);
assert(L.isEmpty(list));
this.close();
- if (list._unrefed === true) {
+ if (list._timer.unrefed() === true) {
delete unrefedLists[msecs];
} else {
delete refedLists[msecs]; |
This reverts commit 9bb5a5e. Refs: nodejs#6382 Refs: nodejs#6204 Refs: nodejs#5834
This reverts commit 9bb5a5e. Refs: nodejs#6395 Refs: nodejs#6204 Refs: nodejs#6401 Refs: nodejs#6382 Fixes: nodejs#6381 Conflicts: src/handle_wrap.cc test/parallel/test-handle-wrap-isrefed-tty.js test/parallel/test-handle-wrap-isrefed.js
This reverts commit 9bb5a5e. This API is not suitable because it depended on being able to potentially access the handle's flag after the handle was already cleaned up. Since this is not actually possible (obviously, oops) this newer API no longer makes much sense, and the older API is more suitable. API comparison: IsRefed -> Has a strong reference AND is alive. (Deterministic) Unrefed -> Has a weak reference OR is dead. (Less deterministic) Refs: nodejs#6395 Refs: nodejs#6204 Refs: nodejs#6401 Refs: nodejs#6382 Fixes: nodejs#6381 PR-URL: nodejs#6546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Conflicts: src/handle_wrap.cc test/parallel/test-handle-wrap-isrefed-tty.js test/parallel/test-handle-wrap-isrefed.js
Rename slightly to HasRef() at bnoordhuis’ request. Better reflects what we actually do for this check. Refs: nodejs#6395 Refs: nodejs#6204 Refs: nodejs#6401 Refs: nodejs#6382 Refs: nodejs#6381 PR-URL: nodejs#6546 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This fixes my perceived usability issues with 7d8882b. Which, at the time of writing, has not landed in any release except v6 RCs. This should not be considered a breaking change due to that. It is useful if you have a handle, even if it has been closed, to be able to inspect whether that handle was unrefed or not. As such, this renames the method accordingly. If people need to check a handle's aliveness, that is a separate API we should consider exposing. Refs: #5834 PR-URL: #6204 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This reverts commit 9bb5a5e. This API is not suitable because it depended on being able to potentially access the handle's flag after the handle was already cleaned up. Since this is not actually possible (obviously, oops) this newer API no longer makes much sense, and the older API is more suitable. API comparison: IsRefed -> Has a strong reference AND is alive. (Deterministic) Unrefed -> Has a weak reference OR is dead. (Less deterministic) Refs: #6395 Refs: #6204 Refs: #6401 Refs: #6382 Fixes: #6381 PR-URL: #6546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Conflicts: src/handle_wrap.cc test/parallel/test-handle-wrap-isrefed-tty.js test/parallel/test-handle-wrap-isrefed.js
@Fishrock123 is there a reason you removed the dont land label for v4.x? This is causing false positives when auditing missing commits from lts |
probably because of nodejs/Release#108 |
ahhh my mistake... I got mixed up between this and the revert issues. Moving to lts-watch. Please feel free to do with the tags what you think is most appropriate |
@Fishrock123 this can be moved to don't land correct? |
Checklist
Affected core subsystem(s)
handle_wrap
Description of change
This fixes my perceived usability issues with #5834, which has not landed in any release except v6 RCs. This should not be considered a breaking change due to that.
It is useful if you have a handle, even if it has been closed, to be able to inspect whether that handle was unrefed or not. As such, I have renamed the method accordingly. If people need to check a handle's aliveness, that is a separate API we should consider exposing.
cc @trevnorris, @jasnell, @cjihrig