vfs: RealFSProvider.watchFile ignores the listener and unwatchFile leaks it
@trivikr ya está trabajando en esto.
Desde el 23/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Version
main
Platform
All
Subsystem
vfs
What steps will reproduce the bug?
import { mkdtempSync, watchFile, writeFileSync, unwatchFile } from "fs";
import { create, RealFSProvider } from "node:vfs";
const d = mkdtempSync("/tmp/v-");
const f = create(new RealFSProvider(d)).mount() + "/f";
const cb = () => console.log("fired");
watchFile(f, { interval:50 }, cb);
setTimeout(() => writeFileSync(f, "x"), 50);
setTimeout(() => {
unwatchFile(f, cb);
console.log("done, should exit");
}, 200);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
fired
fired
done, should exit
fired prints within ~50–100ms of the write (the { interval: 50 } poll detects the stat change), then unwatchFile(f, cb) at 200ms removes the callback and the process exits cleanly with code 0.
What do you see instead?
done, should exit
<process hangs>
fired never prints - even though the change happens at 50ms and the watcher polls every 50ms for 150ms before unwatch. cb was never registered at all. The hang after done, should exit is the leaked stub keeping the loop alive.
Additional information
No response
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.4k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 277
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 nodejs/node
-
doc
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
build
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Todos los issues de nodejs/node
Issues similares
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Automattic/safe-publish#594 ·
-
内部文件键(绝对路径的 base64)泄漏到界面标签 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
NousResearch/hermes-agent#121143 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100