The issue involves complex async resource tracking and isolation.
The issue involves implementing async resource and stack isolation similar to workerd's event loop isolation. This requires tracking async resources and enforcing rules to prevent shared resources between requests. The scope is complex and involves deep understanding of async_hooks and event loop mechanics.
https://nodejs.org/api/async_hooks.html#async-hooks
We're building an emulation tool for workerd's event loop / async resource isolation that aims to be similar in intention. In workerd (or Cloudflare Workers) they track both the event loop for each incoming request and resources it creates.
If the work per request cannot complete workerd issues as "Will never generate a response" error, see: https://developers.cloudflare.com/workers/observability/errors/#the-script-will-never-generate-a-response-errors
The cause of this is a bit abstract and separate from the intention;
new Promise, one request is cancelled, hence, the other can never resolveThis creates a developer experience problem. Not only is it hard to emulate this exact check accurately (as far as I'm aware), it's hard to track why this error is thrown. In development for Expo, we'd instead like to track async resources and proactively create rules that emulate this behaviour while delivering more information on where or why the violation of a rule has occurred.
Long story short: The proof of concept code for this uses async_hooks's createHook with a small graph that attempts to keep track of where async resources are created and resolved: https://github.com/kitten/fiber-dev
The tests show which rules we'd like to enforce:
Claim this issue to let others know you're working on it. You'll earn 35 points when you complete it!