-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: deprecate legacy node::MakeCallback #18632
Conversation
doc/api/deprecations.md
Outdated
Type: Compile-time | ||
|
||
Certain versions of `node::MakeCallback` APIs available to native modules are | ||
deprecated. Please use the versions of the API that accept a `async_context` |
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.
Nit: a `async_context`
-> an `async_context`
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.
As a semver-major this needs two @nodejs/tsc approvals. |
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. Although, I think we need to declare C++ AsyncHooks Embedder API stable before we can do this. But I'm okay with that.
This would have been an ideal way of doing things, but it should not be a requirement IMHO:
IOW, we need this change if we want to move the C++ AsynchHooks Embedder API to move out of experimental. |
@ofrobots Yeah, there is definitely conflicting interests. I think this will be for the TSC to decide. The issue with deprecating it before the C++ Embedder API is marked stable, is that there will be no API for calling a callback that isn't either deprecated or experimental. |
@AndreasMadsen there are prior examples of that. For example, Domains are deprecated even though there is no stable alternative to them (still).
To be pedantic, |
Maybe we could just set a time frame for the actual removal that is far enough in the future, or even better, indicate that we will never actually remove these functions? |
Landed in a570aca 🎉 |
The legacy MakeCallback functions do not provide a mechanism to propagate async context. This means that any native modules using these directly is likely breaking async debugging & tracing tools. For examples it is possible that such a module will cause incorrect async stack traces to be reported (even when the module is not on the stack). The new MakeCallback allow the user to specify the async context in which the callback is to be executed. Ref: nodejs#13254 PR-URL: nodejs#18632 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Should this really have landed with a |
Uh, gosh... I missed that... Hm, I am going to force push it out again as it is only a few minutes ago. |
@nodejs/tsc, this has the Specifically @AndreasMadsen added the label around this question: #18632 (comment). He has LGTM'd this PR, so there isn't a conflict here, I think the intent is to make sure that the TSC is aware that this is happening. @AndreasMadsen please correct me if I misinterpreted your intent here. There are already the requisite 2 TSC LGTMs on this PR required for semver majors. This is time sensitive, and should get into Node 10. As a semver major, it would be good to get this in before March. I am OOO starting next week, so I would like to make progress on this this week. |
Perhaps something that could be discussed at the Diagnostics Summit even, given that @AndreasMadsen is in attendance, I believe. |
@apapirovski We already have an LGTM from @AndreasMadsen. There is nothing to discuss. Unless if some questions/concerns come from the TSC as a result of the |
I think discussing how this API will be handled long term doesn't require blocking this deprecation landing if there is already consensus on doing so. Unless someone has an explicit -1 I feel like perhaps this should land and an issue to discuss long term deprecation should be opened. |
Removing |
Unlike a docs-only deprecation, when native addons are installed, they will start printing compiler warnings about deprecated APIs to the console, where the installer of the addon (who is probably only installing it indirectly via a npm dep, and can't do anything about this) will see them, right? This strikes me as slightly more similar to a run-time deprecation that a doc deprecation. I agree the problematic functions should be completely dropped ASAP so context propagation is preserved. |
@sam-github You're right. I guess it is somewhere in the middle. Compile warnings show up at |
The legacy MakeCallback functions do not provide a mechanism to propagate async context. This means that any native modules using these directly is likely breaking async debugging & tracing tools. For example it is possible that such a module will cause incorrect async stack traces to be reported (even when the module is not on the stack). The new MakeCallback allow the user to specify the async context in which the callback is to be executed. Ref: nodejs#13254 PR-URL: nodejs#18632 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
6bf6eee
to
efb3259
Compare
Landed as efb3259. |
The legacy MakeCallback deprecation was resulting in compile time warnings in adddon tests. Fix them. Ref: nodejs#18632
The legacy MakeCallback functions do not provide a mechanism to propagate async context. This means that any native modules using these directly is likely breaking async debugging & tracing tools. For example it is possible that such a module will cause incorrect async stack traces to be reported (even when the module is not on the stack). The new MakeCallback allow the user to specify the async context in which the callback is to be executed. Ref: nodejs#13254 PR-URL: nodejs#18632 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
The legacy MakeCallback deprecation was resulting in compile time warnings in adddon tests. Fix them. Ref: nodejs#18632 PR-URL: nodejs#18810 Refs: nodejs#18632 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
AsyncResource.emitBefore and AsyncResource.emitAfter have been deprecated in nodejs#18632. This PR removes it all. This commit also updates some embedder tests to use internal APIs. The conditions are still possible for Node.js core developers but not for end users.
AsyncResource.emitBefore and AsyncResource.emitAfter have been deprecated in #18632. This PR removes it all. This commit also updates some embedder tests to use internal APIs. The conditions are still possible for Node.js core developers but not for end users. PR-URL: #26530 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
The legacy
MakeCallback
functions do not provide a mechanism topropagate async context. This means that any native modules using these
directly is likely breaking async debugging & tracing tools. For
example it is possible that such a module will cause incorrect async
stack traces to be reported (even when the module is not on the stack).
We've had context preserving versions of
MakeCallback
available since Node 8.x.Ref: #13254, specifically #13254 (comment).
Related: nodejs/nan#729
This doesn't fit into any of the categories of deprecations as defined in our Deprecation policy. This is an API available to native modules via
node.h
. It is not otherwise documented. Chances are high that any given native module would be using this API. The migration path is fairly easy though.We will now give a compile time warning when a module using the deprecated API is being compiled against Node 10. There is no runtime impact at this point. From this point of view, I guess this is closest to a
Documentation-only
deprecation.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
src, async_hooks
/cc @nodejs/async_hooks @nodejs/addon-api @nodejs/diagnostics
CI: https://ci.nodejs.org/job/node-test-pull-request/13042/