Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeout
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- testing
Línea de trabajo
Lee packages/db/tests/mutation-id.test.ts y packages/db/tests/collection-idle-cleanup.test.ts; después, ejecuta el comando de Vitest para esos dos archivos desde packages/db bajo carga de CPU para confirmar los timeouts. Comprueba cómo importa cada prueba el grafo de módulos de Collection y cómo gestiona la configuración; el scheduler de limpieza en inactividad debe instalarse antes de importar su polyfill. La tarea estará terminada cuando ambas pruebas pasen de forma fiable bajo carga, sin debilitar sus assertions.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Two @tanstack/db tests fail with Test timed out in 5000ms when the machine is busy. They pass when the suite runs alone.
Tests
packages/db/tests/mutation-id.test.ts>mutation ids > do not draw random values during module evaluationpackages/db/tests/collection-idle-cleanup.test.ts>cancels a rescheduled idle cleanup when a subscriber returns
Reproduction
Run the two files while other test processes load the CPU. I ran them while four other vitest run processes ran the full @tanstack/db suite on an 18-core machine:
cd packages/db
npx vitest run tests/mutation-id.test.ts tests/collection-idle-cleanup.test.ts
Result over four runs:
| Run | mutation-id |
collection-idle-cleanup |
|---|---|---|
| 1 | timed out (5005 ms) | timed out (5014 ms) |
| 2 | timed out (5003 ms) | timed out (5004 ms) |
| 3 | timed out (5004 ms) | timed out (5004 ms) |
| 4 | timed out (5004 ms) | passed |
Without the other processes, the full suite passes (285 files, 13,816 tests).
Probable cause
Each test starts with a cold dynamic import() of the Collection module graph inside the test body:
mutation-id.test.tscallsvi.resetModules()and then imports../src/collection/index.jsand../src/local-only.js.collection-idle-cleanup.test.tsimports../src/collection/index.jsand../src/utils/browser-polyfills.js, because it must install its idle scheduler before the polyfill module loads.
The transform and load of that graph count against the test's 5000 ms default timeout. Under CPU load, the import alone can use the full budget. The work after the import takes a few milliseconds, plus an 80 ms wait in the idle-cleanup test.
I did not measure the import time separately, so this cause is probable, not proven.
Effect
- A slow or shared CI runner can fail these tests for no product reason.
- Tools that run the suite in parallel, such as mutation sweeps, record false failures. Both tests made a mutation sweep report every mutant as killed.
Possible fixes
- Give each test an explicit timeout that covers a cold import, for example
30_000. - Or move the import out of the timed test body where the test's isolation requirement allows it. The idle-cleanup test needs its scheduler installed before the polyfill module loads, so its import must stay after that setup.
- Lenguaje dominante
- TypeScript
- Estrellas
- 4k
- Forks
- 277
- Merge medio
- 17 h 33 min
- PR fusionados (30 d)
- 227
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/db
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Electric: scoped move-in snapshots can prematurely resolve awaitTxId and remove optimistic rowsAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/db
Issues similares
-
freshness freshness:observed-only
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
thoroc/context-radar#282 ·
-
bug P2 rust
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
area: web
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
gabe-santana/arkdraw#25 ·
-
bug require-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
expressjs/expressjs.com#2549 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
bug good first issue hacktoberfest
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
codercops/discord-bot#101 · 1 comentario ·
Los mantenedores suelen responder en 1 día