-
Notifications
You must be signed in to change notification settings - Fork 25.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
zones.js, async_hooks, and low-level primitives #31727
Comments
@elierotenberg , yes, we are working on this. you can find some progress here.
but currently there are some issues about the API provided by Thank you. |
Right back atcha @elierotenberg, you might find this interesting nodejs/CTC#166 |
Your proposal only helps node.js. Angular is primarily focused on browser. With the upcoming |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Hello folks,
I'm currently working on a visualisation / developper tools experiment to help tackle the issues of time / memory multiplexing in long-running JS apps (Node HTTP servers, web apps, native apps programmed in JS). I'm by no means an expert in systems, scheduling or JS spec/engines, but I've encountered very tedious related bugs in production and this is me trying to prevent them.
I've done some work based upon the new
async_hooks
API, which raises interesting questions and has led me to think that what I need is a primitive to handle continuation with context between async stack frames scheduled using the host environment I/O APIs (eg.fs.readFile
,window.requestAnimationFrame
), host event loop scheduling APIs (http.createServer
,window.addEventListener
), and JS scheduling APIs (eg.new Promise
,async/await
).Such a primitive would allow us to build more advanced multiplexing primitives (eg. coroutines, algebraic effects, actors...).
I believe that
async_hooks
allows us to do something very close to this in Node, and thatzones.js
has done an amazing work around the same ideas.My current prototype is very crude and I think that
async_hooks
allows us to detect/visualize issues but not to prevent them at runtime. However, this alone could help us catch bugs in dev/test phase and certainly be an improvement from the current situation. Signaling a bug is not preventing it but at least it doesn't creep until it blows in your face the way leaking Promises/requestAnimationFrame do.Would it make sense to work on a base implementation/polyfill that would expose similar low-level primitives both in Node (using
async_hooks
) and in the browser (using globals monkey-patching)? Couldzones.js
be implemented in terms of such a primitive? Could the monkey-patching part ofzones.js
be used as part of the implementation?The text was updated successfully, but these errors were encountered: