RuntimeError: memory access out of bounds in yoga-layout WASM during "Loading sessions"

Aperta
#839 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js, wasm
Ambito
cli

Direzione di ricerca

Riproduci il crash intermittente all’avvio durante “Loading sessions…”. Leggi renderer.js:32 e i percorsi di cleanupYogaNode in removeChild e removeChildFromContainer, quindi traccia il modo in cui il callback di rendering con debounce mantiene i nodi. Il lavoro è completato quando il caricamento delle sessioni non provoca più il crash di accesso alla memoria WASM durante la lettura del layout.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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:

  1. React's reconciler destroying nodes (calling freeRecursive() via cleanupYogaNode in removeChild/removeChildFromContainer)
  2. 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.

Lingua principale
Nessun dato sulla lingua
Stelle
4k
Fork
350
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommandCodeAI/command-code

Tutte le issue di CommandCodeAI/command-code

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.