-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 experimental status #14717
Comments
cc @nodejs/async_hooks |
@martinkuba hello, a little bit of context:
My very subjective estimation is that the "user" API will not change much. Most of the work being done is on the "embedder" API i.e. code that wants to trigger the hooks, not code that wants to use the hooks and query the graph. IMHO go for it, but I'm a bleeding edge kind of guy, so it is very dependant on your needs and organizational constraints. |
In my opinion: treat it as if it were behind a flag. I can almost guarantee there are going to be API changes, although we will try to make them backward compatible in 8.x, but that is only until it becomes to inconvenient. During 8.x we have already deprecated 6 function calls or something like that. |
@refack @AndreasMadsen Thanks for your replies, I really appreciate it. Have there been any performance tests done - to determine overhead and also to look for memory leaks when running over long period of time? If yes, can you please point me to those tests? We are running benchmark tests ourselves, and would like to compare with any existing results. |
@martinkuba that's a good questions re:
In this case I can only contribute anecdotal data-points. Personally I know of one project (small-medium) that uses async-hooks in a long running system in production, they are not doing rigorous benchmarking, but have not been noticing memory leaks or performance degradation. It's also a complicated data-point to analyse since they upgraded from
P.S. https://twitter.com/refack/status/896460320079785987 - #14794 |
@mcollina asked about the plans for the experimental status. Let's have the discussion here. What I would like to see done before moving out of experimental status:
edited: added new links to #15572 and #15454. |
Oh, good idea. I was thinking of just leaving it for debug build, but adding a flag or env var is an excellent idea. You have any ideas about how it should be implemented? And for future generations reading this: the only reason I removed some of the validation was because of the ecosystem breakage and not being able to find an alternative solution quickly enough. If the edge cases that caused those failures could be determined I'd like to eventually re-add all state validation. |
@trevnorris Well, as I have mentioned a few times I think we should just check |
Just for context, AFAIK there hasn't been a critical |
@refack That is likely a false positive, there hasn't been an issue because we removed/relaxed the asserts. That doesn't mean there is no async_hooks state errors. It just means we are not seeing them anymore. |
@AndreasMadsen we cannot ship a Node.js release with tight asserts by default. If we need them to exists, then let's put them behind a flag. In this way, we can test this in applications without causing problems for everybody else that might not even be using async_hooks. |
Fwiw, #15448 is a pretty fresh crash coming from |
Everyone seems to misunderstand what I'm saying. I will try and prepare a pull request today. |
@trevnorris @mcollina #15454 is what I have in mind. |
/cc @jasnell, see #14717 (comment) for my stable-requirements list. |
PR-URL: #15454 Ref: #14387 Ref: #14722 Ref: #14717 Ref: #15448 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs/node#15454 Ref: nodejs/node#14387 Ref: nodejs/node#14722 Ref: nodejs/node#14717 Ref: nodejs/node#15448 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
PR-URL: nodejs/node#15454 Ref: nodejs/node#14387 Ref: nodejs/node#14722 Ref: nodejs/node#14717 Ref: nodejs/node#15448 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Has anyone tried using V8 supports a kind of cooperative multithreading, provided you use Here's an example of where this can go wrong: laverdet/node-fibers#357. Note: although Essentially, if you push an async ID on one thread, then switch threads and push another ID, then switch back to the first thread and pop the first ID, you get the corruption error because How can we make the |
@benjamn Please open another issue, then we can discuss it there. |
It seems like perhaps this should be closed. Feel free to re-open (or leave a comment requesting that it be re-opened) if you disagree. I'm just tidying up and not acting on a super-strong opinion or anything like that. |
We are looking at using async_hooks to maintain state in our instrumentations when async/await is used. What is your recommendation for using async_hooks in production code at this point?
We realize that it is marked as experimental API. However, it is not gated with a flag. Is the API likely to change? When do you think it will come out of experimental status?
The text was updated successfully, but these errors were encountered: