[JsRuntimeHost] No adapter implements napi_add_env_cleanup_hook, forcing per-environment native state to be process-global
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- cpp, javascript
- 領域
- backend
調査の方向性
Start with grep for napi_add_env_cleanup_hook under Core/Node-API/Source, which currently has no matches, then read Core/Node-API/Include/Shared/napi/napi-inl.h where Napi::Env::AddCleanupHook calls it. The adapters to change are js_native_api_chakra.cc, js_native_api_javascriptcore.cc, js_native_api_quickjs.cc and js_native_api_v8.cc. Done means the hook is implemented in each adapter and Polyfills/URL/Source/URL.cpp can scope its blob URL store per environment and clear it on teardown.
索引モデルが issue の本文から書いたものです。
説明
Summary
There is no portable way to run native cleanup when a JS environment is torn down, because no Node-API adapter in Core/Node-API/Source implements napi_add_env_cleanup_hook:
$ grep -rn "napi_add_env_cleanup_hook" Core/Node-API/Source
(no matches)
The only reference anywhere in the repo is the vendored node-addon-api header Core/Node-API/Include/Shared/napi/napi-inl.h, which calls it from Napi::Env::AddCleanupHook. That call has no implementation behind it in js_native_api_chakra.cc, js_native_api_javascriptcore.cc, js_native_api_quickjs.cc or js_native_api_v8.cc.
Impact
Native polyfill state that logically belongs to an environment has to be made process-global instead, and then leaks for the life of the process.
The concrete case is the blob URL store added in BabylonJS/JsRuntimeHost#207 (Polyfills/URL/Source/URL.cpp). URL.createObjectURL registers an entry that is normally released by URL.revokeObjectURL. Entries that are never revoked should be released when the environment goes away -- that is what a browser does at unload. With no teardown hook the store must be process-global, so an embedder that creates and destroys environments over the process lifetime accumulates every un-revoked blob URL, and the buffers behind them, until the process exits.
Polyfills/URL/Include/Babylon/Polyfills/URL.h documents the store as process-global for exactly this reason, and RegisterObjectURL/RevokeObjectURL already take a Napi::Env that is currently unused, kept for future per-env scoping.
Suggested fix
Implement napi_add_env_cleanup_hook and napi_remove_env_cleanup_hook in the adapters, then scope the blob URL store per environment and drop its entries from the cleanup hook.
Notes
Not covered by the existing issues: BabylonJS/JsRuntimeHost#194 was the JSC napi_typeof bug, BabylonJS/JsRuntimeHost#213 was the UrlLib blob: scheme resolver (implemented in BabylonJS/JsRuntimeHost#207), and BabylonJS/BabylonNative#2047 is the UrlLib Apple lifetime bug.
- 主要言語
- C++
- スター
- 931
- フォーク
- 169
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 66
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
BabylonJS/BabylonNative のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
BabylonJS/BabylonNative#2138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BabylonJS/BabylonNative#2042 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
BabylonJS/BabylonNative#2052 ·
メンテナーはふだん 1 日以内に返信
-
testing
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
BabylonJS/BabylonNative#2136 ·
メンテナーはふだん 1 日以内に返信
-
Support useNDCHalfZRange (half-range NDC depth) so Babylon.js half-range depth visual tests can run対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
BabylonJS/BabylonNative#2134 ·
メンテナーはふだん 1 日以内に返信
BabylonJS/BabylonNative の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[Bug]: pip install -U cudaq-qec fails with a conflict that names cudaq-qec itself対応中かも @fedonman が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
task
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SparseLinearAlgebra/spla#316 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 3 日以内に返信