[2.0] A long memo chain overflows the stack in the commit/settle path

Cerrado
#4,587 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript, typescript
Área
frontend

Línea de trabajo

The bug is in the commit and settle walks, including settlePendingSource and the staged-error marking, which recurse once per memo node in the reactive graph. Start by reading those functions in the reactive core and reproducing with a warm-built chain of about 8,000 memos over a rejecting async source. Done means the walks are iterative with an explicit stack and the error surfaces as E:boomA at that depth.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

What happens

A chain of createMemo nodes over an async source, read under <Errored> with isPending, overflows the call stack in the commit/settle path once the chain is long enough.

  • On next, a warm-built chain of about 8,000+ memos surfaces E:Maximum call stack size exceeded as the rendered error, in place of the source's own error.
  • With #4582 (the settle walk also stage-marks chain nodes via stageMark), the walk recurses through chains too. At about 15,000 nodes it silently drops the staged E:boomA frame instead of erroring.

Real apps rarely build chains this deep, but the error should be the source's (boomA), never a stack overflow, and a frame should never be dropped without an error.

Repro shape

  1. Make an async source that rejects with new Error("boomA").
  2. Build a chain of N createMemo nodes, each reading the previous one, after the source has a first value (warm build).
  3. Read the last memo under an Errored boundary, together with isPending(last), in a render effect that records frames.
  4. Trigger the rejecting flight and flush.

With N ≈ 8,000 on next, the recorded error is Maximum call stack size exceeded. Expected: E:boomA.

Likely fix direction

Make the commit/settle walks (including settlePendingSource and the staged-error marking) iterative with an explicit stack, instead of recursing per node.

Found during review of #4582. It doesn't block that PR, because next already fails at a shallower depth.

Lenguaje dominante
TypeScript
Estrellas
36.2k
Forks
1.1k
Merge medio
10 h 39 min
PR fusionados (30 d)
500

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de solidjs/solid

Todos los issues de solidjs/solid

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.