-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: unmerge resource_symbol
from owner_symbol
#40741
async_hooks: unmerge resource_symbol
from owner_symbol
#40741
Conversation
This comment has been minimized.
This comment has been minimized.
@nodejs/diagnostics (btw @vdeturckheim would you like to be added to that team?) |
cc @nodejs/async_hooks |
This comment has been minimized.
This comment has been minimized.
@targos thanks for the heads up, I am in @nodejs/async_hooks but it probably makes sense for me to join @nodejs/diagnostics too 🤔 |
@vdeturckheim I don't see you in the async_hooks team either. |
Seems I missed #38468... IMO, Seems to me like it'd be best to revert #38468 and keep those separate, or maybe an owner hierarchy where the regular |
Could you please share some use cases that need the
In that case, I think bea58a1 should be fine?
If I'm not wrong, currently the |
5ab8518
to
12abaf7
Compare
I would also be curious about this – both |
Any sort of connection pooling needs an AsyncResource rather than the public API object to express the individual task, because sharing a resource across multiple tasks will corrupt the context. This happens in http.Agent and many places in userland code. This is why the resource was separate from owner in the first place. It could be nested on the owner though, but I feel like we would want something a bit less fragile than a bunch of constructor name checks which, as I said, can be broken by simply sub-classing AsyncResource, which a bunch of userland already does. I do agree with the idea of simplifying this as much as we can, but what we're seeing here is that we simplified too much and broke the handle reuse code. We still need to handle that properly somehow, so I feel the removal of resource_symbol needs a bit more thought. I won't block on this PR, because this needs fixing quickly, but I would request at least a comment with a big, bold WARNING about the safety of constructor name checking and a TODO to improve the handling of that. |
If you're talking about handle reuse, I've added the tests back in 323f8a7, which I removed by mistake instead of fixing them in #38468, so I think it still works as expected.
Wasn't this already addressed in bea58a1 or am I missing something here? |
Yep, I had missed those changes when I wrote that comment as I had left the tab open for awhile to review before commenting and it had not updated itself. The current way is better but I'm not a fan of putting a bunch of lazy loading in such a hot function. The I'm still feeling like reverting the previous change is the better solution. It kind of sucks having two similar purposed properties, but much better for performance than trying to compute that every time it's accessed, which will happen more or at least as much and requires more logic to map back to what it was than just the original storing the resource in a symbol property. |
323f8a7
to
2615107
Compare
AsyncLocalStorage
resource_symbol
from owner_symbol
I ran some benchmarks locally and indeed there was a 23% slow down for |
This comment has been minimized.
This comment has been minimized.
Source: nodejs/node#40741 Pushed as orgads/node:16.13.0-asyncfix-alpine
Thank you very much. Will it be backported to v16 automatically? |
Thanks. |
Hello folks, is there a particular reason why this change was not back ported into v16.x yet? Cheers,
|
When is the next 16 release planned? It's been a month since the last minor release. Previous releases were more frequent. I couldn't find a release roadmap/schedule anywhere. |
Currently planned for sometime in January nodejs/Release#658 |
This reverts 7ca2f13 and 937bbc5 and adds some regression tests for the referenced issue.
Fixes: #40693
Signed-off-by: Darshan Sen darshan.sen@postman.com