Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#66,223 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@trivikr がすでに取り組んでいます。

2026年9月23日 から。

評価

この issue はまだ評価されていません。

説明

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

主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 2時間
マージ済み PR(30日)
277

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/node のほかの issue

nodejs/node の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。