Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

vfs: RealFSProvider.watchFile ignores the listener and unwatchFile leaks it

Offen
#66,223 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@trivikr arbeitet bereits daran.

Seit 23.9.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

vfs
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

Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.4k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
277

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nodejs/node

Alle Issues in nodejs/node

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.