| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@addaleax build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/367/pipeline |
Sorry, something went wrong.
There was a problem hiding this comment.
Nice.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
I forget if there's a deprecation process for to remove strings from Environment, but looks like the last two use cases for env->owner_string() are removed here, so that could possibly be ✂️as well |
Sorry, something went wrong.
|
@maclover7 env.h has NODE_WANT_INTERNALS guards, it’s private API and we don’t need to worry about that. I’ve removed them, thanks for catching that 🙂 |
Sorry, something went wrong.
There was a problem hiding this comment.
What will happen if we have a pathological case of cyclic ownership?
a[owner_symbol] = b; b[owner_symbol] = a;
Is there a cycle safe STL algorithm for such a recursive walk?
Sorry, something went wrong.
There was a problem hiding this comment.
It’s going to run into an infinite loop, yes.
Is there a cycle safe STL algorithm for such a recursive walk?
No, but you could implement something like a set of seen objects. The performance impact would be very noticeable, though.
Sorry, something went wrong.
There was a problem hiding this comment.
You could just limit the loop to an arbitrary number of iterations and crash. IMHO better than a infinite busy loop, but I have no strong feelings about this.
Sorry, something went wrong.
|
This is awesome, does this mean we can also start exposing the owner resource as the async_hooks resource? |
Sorry, something went wrong.
Certainly safer to do so. I still think it may be worthwhile exploring a minimal shared interface for such resources, but I'd be much happier exposing the owner than the handle. |
Sorry, something went wrong.
|
@AndreasMadsen @jasnell I’d really like that (and the fact that GetOwner() methods are being introduced here are a step towards it), but it’s not happening in this PR at least because the native handles are constructed before the property can be set on them. I think it’s doable but not trivial to make that work. |
Sorry, something went wrong.
|
This needs a rebase. |
Sorry, something went wrong.
Instead of somtimes using an `owner` string to link from a native handle object to the corresponding JS object, standardize on a single symbol that fulfills this role.
This makes it easier to provide public APIs in the return types of `process._getActiveHandles()` and `process._getActiveRequests()`.
Sorry, something went wrong.
|
This seems like a good idea. Two questions:
|
Sorry, something went wrong.
|
Hmm, on second thought... since this symbol isn't exposed, doesn't this make it difficult to get the owner from a handle as available from an async hook callback? |
Sorry, something went wrong.
|
@Fishrock123 Just want to point out that the resource in async_hooks is not a public API. Especially since running console.log(resource) can crash the application ;)
|
Sorry, something went wrong.
That doesn't make it not a thing to think about.
I can think of lots of ways to crash a node application. Yes, accessing a resource during the init callback specifically is sometimes one of them. That doesn't mean that people aren't using it, or that it is useful, or that there aren't use-cases we should still keep in mind even for "unofficial" things. |
Sorry, something went wrong.
I’m not sure what more to provide than getter/setter pairs for the deprecated properties. The more breaking-change-y patches will be when we add this symbol to other types of handles.
No hurry, I’d say.
@Fishrock123 Would that concern be alleviated once we move async_hooks to also use this symbol for resource objects? |
Sorry, something went wrong.
|
New CI: https://ci.nodejs.org/job/node-test-pull-request/16121/ Edit: Resume CI: https://ci.nodejs.org/job/node-test-pull-request/16127/ Edit: Resume Resume CI: https://ci.nodejs.org/job/node-test-pull-request/16147/ |
Sorry, something went wrong.
Sorry, something went wrong.
Instead of somtimes using an `owner` string to link from a native handle object to the corresponding JS object, standardize on a single symbol that fulfills this role. PR-URL: #22002 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
This makes it easier to provide public APIs in the return types of `process._getActiveHandles()` and `process._getActiveRequests()`. PR-URL: #22002 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
|
Should this be backported to v10.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label. Backport should be relatively easy. There is one more instance of owner_string in src/timer_wrap.cc. |
Sorry, something went wrong.
Instead of somtimes using an `owner` string to link from a native handle object to the corresponding JS object, standardize on a single symbol that fulfills this role. PR-URL: nodejs#22002 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
This makes it easier to provide public APIs in the return types of `process._getActiveHandles()` and `process._getActiveRequests()`. PR-URL: nodejs#22002 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
| Back | FazBrowse Home | New Git URL |
Use a standardized owner_symbol key to access the corresponding “public” JS wrapper object for a native handle. Currently, this is only implemented for the objects that already had some sort of owner keys, but this should be a first step towards making this a more common pattern.
/cc @nodejs/diagnostics
Checklist