-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Asynchook is using destroyed AsyncId for new executions #27467
Comments
@nodejs/async_hooks |
see #26961 (comment) |
@Flarna Let us know if you need anything, and you can always open a WIP PR if you want. |
@addaleax most likely I will create a PR today. Another option would be to revert #25094. We would still have the double destroy reported in #26961 but I think they are easier to fix and even if not fixed the impact is lower. |
Fix some issues introduced/not fixed via #25094: * Init hook is not emitted for a reused HTTPParser * HTTPParser was still used as resource in init hook * type used in init hook was always HTTPINCOMINGMESSAGE even for client requests * some tests have not been adapted to new resource names With this change the async hooks init event is emitted during a call to Initialize() as the type and resource object is available at this time. As a result Initialize() must be called now which could be seen as breaking change even HTTPParser is not part of documented API. It was needed to put the ClientRequest instance into a wrapper object instead passing it directly as async resource otherwise test-domain-multi fails. I think this is because adding an EventEmitter to a Domain adds a property 'domain' and the presence of this changes the context propagation in domains. Besides that tests still refering to resource HTTPParser have been updated/improved. Fixes: #27467 Fixes: #26961 Refs: #25094 PR-URL: #27477 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]>
I was using asyncHook to create a request context middleware on a http server.
But on the v12.0.0, asynchook is using destroyed AsyncIds for new executions/requests.
Below is code to simulate this behavior and two logs.
One running on Node v12.0.0 and another on v11.14.0
Executed on node 12.0.0
New requests receives destroyed asyncIds
Executed on node 11.14.0
New requests receives different asyncIds
The text was updated successfully, but these errors were encountered: