Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#66,223 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@trivikr đang làm issue này rồi.

Từ ngày 23/9/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.4k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
279

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nodejs/node

Tất cả issue của nodejs/node

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.