CommandCodeAI / CommandCodeAI/command-code
RuntimeError: memory access out of bounds in yoga-layout WASM during "Loading sessions"
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 4k
- Fork
- 350
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Crash Report
Error
✖ CRITICAL: Uncaught Exception!
✖ ERROR → RuntimeError
ℹ REASON → memory access out of bounds
Stack Trace
RuntimeError: memory access out of bounds
at wasm://wasm/000460e2:wasm-function[215]:0xd5ef
at wasm://wasm/000460e2:wasm-function[185]:0xcf8c
at X.getComputedWidth (yoga-wasm-base64-esm.js:33:52)
at renderer (renderer.js:32:49)
at onRender (ink.js:348:56)
at debounce (debounce.mjs:12:17)
at invoke (debounce.mjs:45:9)
at onTimerEnd (debounce.mjs:51:17)
at Timeout._onTimeout (debounce.mjs:59:4)
Environment
- Command Code version: 1.53.0
- Node.js: v26.1.0 (via nvm)
- yoga-layout: 3.2.1
- ink: 7.1.0
- OS: Linux
Reproduction
This crash occurs during "Loading sessions…" — it happens intermittently when the app starts up and loads saved sessions.
Trace ID
3a1270ebb1c389e7db6257397a21f5e0
Analysis
The crash happens in renderer.js:32 when node.yogaNode.getComputedWidth() is called on a yoga node whose WASM memory has already been freed. This appears to be a race condition between:
- React's reconciler destroying nodes (calling
freeRecursive()viacleanupYogaNodeinremoveChild/removeChildFromContainer) - The debounced render callback still trying to traverse the node tree and compute layout on the now-deallocated WASM node
This is triggered when rapid state changes occur (e.g., mounting/unmounting components during "Loading sessions"), causing a yoga node to be freed in one tick while the throttled renderer still holds a reference.
Suggested Fix
Add a guard in renderer.js to check whether yogaNode is still valid before calling getComputedWidth(), or wrap the WASM call in a try-catch to handle freed nodes gracefully.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện lỗi crash không liên tục khi khởi động trong lúc “Loading sessions…”. Đọc renderer.js:32 và các đường đi của cleanupYogaNode trong removeChild và removeChildFromContainer, sau đó theo dõi cách callback render được debounce giữ lại các node. Hoàn thành khi việc tải session không còn gây ra lỗi crash truy cập bộ nhớ WASM khi đọc layout.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js, wasm
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100