JS thread deadlocks in NativeEngine::SubmitCommands when an engine is disposed and a new one created quickly
@CedricGuillemet 已经在做这个了。
开始于 2026年12月2日。
评估
调研方向
Start in NativeEngine.cpp at SubmitCommands (around line 4005), then trace DeviceContext.cpp's AcquireFrameCompletionScope and the ReactNativeEngine.dispose/reset path described in the report. Reproduce by rapidly unmounting and remounting EngineView after its first frame, and inspect how asynchronous resetView interacts with rendering. Done means the new engine renders reliably after repeated quick remounts.
由索引模型根据 Issue 内容生成。
描述
Environment: @babylonjs/react-native 2.0.7 (Babylon Native f4d9efb), React Native 0.81.6 (legacy architecture), Hermes, Xcode 27.1, iOS 27.0 Simulator (iPhone 17), macOS 27.0.1.
Steps
- A component calls
useEngine()and renders<EngineView camera={…} />with a non-trivial scene (shadows, glow,
GUI). - Unmount it and mount a fresh instance (new
useEngine(), newEngineView) several times in quick succession.
Re-mounting within about 1 s of the previous scene's first frame is enough.
Expected: the new engine renders.
Actual: the app freezes at 0% CPU. No crash report is written. The JS thread blocks forever:
Babylon::NativeEngine::SubmitCommands(Napi::CallbackInfo const&) NativeEngine.cpp:4005
Babylon::Graphics::DeviceContext::AcquireFrameCompletionScope() DeviceContext.cpp:67
Babylon::Graphics::FrameCompletionScope::FrameCompletionScope(DeviceImpl&) DeviceContext.cpp:47
Babylon::Graphics::DeviceImpl::IncrementPendingFrameScopes() DeviceImpl.cpp:525
std::condition_variable::wait(std::unique_lock<std::mutex>&)
This reproduces in both Debug and Release. Likely cause: ReactNativeEngine.dispose() → reset() →
BabylonModule.resetView() runs asynchronously, so it can land after the new view has re-enabled rendering. The new
engine then submits into a device that never starts another frame.
Workaround: keep one engine and one EngineView for the app lifetime and dispose only scenes. An extra scene with
autoClear = false keeps frames flowing when no "real" scene is shown.
- 主要语言
- C++
- 星标
- 437
- 派生
- 72
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
BabylonJS/BabylonReactNative 的其他 Issue
-
Docs: New Architecture is not supported; GUI text needs a font可能已有人在做 @CedricGuillemet 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
BabylonJS/BabylonReactNative#777 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 54/100
BabylonJS/BabylonReactNative#776 · 已指派 1 人 ·
-
Playground Metro fails to start: exclusionList is not a function可能已有人在做 @CedricGuillemet 今天认领。 未关闭
难度 3/5 1-2 天 新手友好度 58/100
BabylonJS/BabylonReactNative#775 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 48/100
BabylonJS/BabylonReactNative#774 · 1 条评论 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 25/100
BabylonJS/BabylonReactNative#667 ·
查看 BabylonJS/BabylonReactNative 的全部 Issue
相似的 Issue
-
[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 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复