Skip to content
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

对异步函数 冲突的程序返回PromiseSession 任务 而不是直接报错 以此实现 Promise函数不分离调用 #31

Closed
kihlh opened this issue Dec 12, 2023 · 3 comments
Assignees

Comments

@kihlh
Copy link
Owner

kihlh commented Dec 12, 2023

以下几种情况下都会导致会导致异步工作环境竞态冲突和无法释放工作内存 导致进程奔溃
napi_create_async_work

https://github.com/nodejs/node/blob/main/src/node_api.cc#L2871
nodejs/node#13512
https://github.com/nodejs/node-addon-api/blob/main/napi-inl.h#L5116

@kihlh
Copy link
Owner Author

kihlh commented Dec 12, 2023

napi不支持 同个异步函数同时并发,会导致竞态冲突和无法释放工作内存 导致进程意外的退出,所以我拦截了重复的async请求
所以使用 PromiseSession 来实现异步的同步并发 Promise任务来实现快速执行

image
image
image

@kihlh
Copy link
Owner Author

kihlh commented Dec 12, 2023

而 PromiseSession 使用的是同步io获取结果 内容生产者由异步控制

@kihlh kihlh self-assigned this Dec 13, 2023
@kihlh
Copy link
Owner Author

kihlh commented Dec 15, 2023

  • 已支持

@kihlh kihlh closed this as completed Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant