-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: use libuv's refcounting directly #6395
Conversation
Nice, LGTM! |
LGTM |
This still has the same behavior though? i.e. Should we just track this in JS? NOT lgtm since this will interfere with likely reverts of my commits. |
@Fishrock123 fwiw, #6381 passes when replayed on top of this |
I'm not sure what 'this' refers to. The reference count, liveliness, or something else? |
LGTM. Should this go into v6? |
Well... #6401 might block that. |
Don't implement an additional reference counting scheme on top of libuv. Libuv is the canonical source for that information so use it directly. PR-URL: nodejs#6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
This also updates the tests to expect that a closed handle has no reference count. PR-URL: nodejs#6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Verify that a second call to handle.close() is a no-op. PR-URL: nodejs#6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
fd087d5
to
4282405
Compare
Seeing how the reverts never landed (#6401 (comment)), I went ahead and landed this in 23818c6...4282405. |
That's fine; but this is also a behavior breaker and will make fixing my stupid API problems even more complex. |
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 <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Trevor Norris <[email protected]> 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 <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Don't implement an additional reference counting scheme on top of libuv. Libuv is the canonical source for that information so use it directly. PR-URL: #6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
This also updates the tests to expect that a closed handle has no reference count. PR-URL: #6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Verify that a second call to handle.close() is a no-op. PR-URL: #6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
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 <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Trevor Norris <[email protected]> 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: #6395 Refs: #6204 Refs: #6401 Refs: #6382 Refs: #6381 PR-URL: #6546 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
I'm setting this as don't land... @Fishrock123 / @bnoordhuis please let me know if that is incorrect |
Hmmmm, seems fine unless @bnoordhuis Thinks it's important to backport. May need to be manual because this depended on my handle wrap additions. |
I'm okay with having it back-ported (as long as I don't have to do the work - hah!) but it's not strictly necessary from a 'bug fixes only' perspective. |
I'll put it on watch and see if it lands nicely... if it doesn't we just won't do it 😄 |
@bnoordhuis this does not land cleanly and I've added the dont-land label. Please feel free to revisit this if you like |
The first commit is cleanup:
The second one is what I think the logic should be:
R=@Fishrock123
CI: https://ci.nodejs.org/job/node-test-pull-request/2398/