-
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
async_hooks: prevent async storage methods leaking to outer context #31950
Conversation
Also, with the addition of the |
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.
Couple comments, also, I am afraid this comes with a perf cost in the *SyncAndReturn(...)
methods
Yes, there would be some perf cost to the |
Because of |
This PR was aimed to fix nested Yet, I don't see any tests that verify the fix. |
No it wasn't, I made this as an improvement not as a fix. I can rework it to verify that it fixes that too though, if you want, as it probably does. |
Added a test to verify it fixes that issue. |
I restored the Also, what do you all think about just making the |
I like the idea of keeping only a single pair of methods. But I'd rather rename |
@Qard I don't really understand the benchmarks, did you delete one message? Also, if I understand well, we still introduce a perf impact on the sync path that grows with the number of concurent instances. I'd like to avoid this case. |
Yes, I deleted a comment awhile ago as I ran the benchmark wrong. The correct benchmark is the one in the thread near the top of the PR. It shows that the performance difference is basically non-existent. |
5e07676
to
2b6a63c
Compare
Rebased as #31930 has landed now. |
2b6a63c
to
23a0772
Compare
Probably worth waiting for #31998 to land first |
417ff73
to
2db2994
Compare
Marked this one with |
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
Sounds fine to me. 👍 |
`runSyncAndReturn` was removed from Node.js in nodejs/node#31950
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
PR-URL: nodejs#31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
Notable Changes: * async_hooks**: * Merge `run` and `exit` methods (Andrey Pechkurov) #31950 * Prevent sync methods of async storage exiting outer context (Stephen Belanger) #31950 * vm: * Add `importModuleDynamically` option to compileFunction (Gus Caplan) #32985 New core collaborators: With this release, we welcome two new Node.js core collaborators: * Juan José Arboleda @juanarbol #32906 * Andrey Pechkurov @puzpuzpuz #32817 PR-URL: #33122
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
PR-URL: #31950 Reviewed-By: Vladimir de Turckheim <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
Notable Changes: * async_hooks**: * Merge `run` and `exit` methods (Andrey Pechkurov) #31950 * Prevent sync methods of async storage exiting outer context (Stephen Belanger) #31950 * vm: * Add `importModuleDynamically` option to compileFunction (Gus Caplan) #32985 New core collaborators: With this release, we welcome two new Node.js core collaborators: * Juan José Arboleda @juanarbol #32906 * Andrey Pechkurov @puzpuzpuz #32817 PR-URL: #33122
Notable Changes: * async_hooks**: * Merge `run` and `exit` methods (Andrey Pechkurov) #31950 * Prevent sync methods of async storage exiting outer context (Stephen Belanger) #31950 * vm: * Add `importModuleDynamically` option to compileFunction (Gus Caplan) #32985 New core collaborators: With this release, we welcome two new Node.js core collaborators: * Juan José Arboleda @juanarbol #32906 * Andrey Pechkurov @puzpuzpuz #32817 PR-URL: #33122
@Qard Sorry if I misunderstand something, but was this merged only to 12.x but not to 14.x? |
@kibertoad a683e87 is the commit that landed on 14.x branch and is released with v14.0.0. |
The
_exit
logic is not actually necessary as explained here. This eliminates it and gives sync context runs a properAsyncResource
.cc @vdeturckheim @puzpuzpuz @Flarna
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes