Skip to content

vfs: forward the watchFile listener through RealFSProvider - #66224

Open
trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:vfs-watchfile-listener-ignore
Open

trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:vfs-watchfile-listener-ignore

Conversation

@trivikr

@trivikr trivikr commented Sep 23, 2026

Copy link
Copy Markdown
Member

Fixes: #66223

fs.watchFile() on a path served by a real-directory mount dispatches to RealFSProvider.watchFile(), which ignored the supplied listener and registered an empty function instead. The user callback never fired after the file changed, and fs.unwatchFile(path, listener) could not match the anonymous stub, so the stat watcher's poll timer stayed registered and kept the process alive.

Accept the listener and pass it through to fs.watchFile() so the callback fires on change and unwatchFile() removes it by identity.


Assisted-by: opencode

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem. labels Sep 23, 2026
@trivikr
trivikr force-pushed the vfs-watchfile-listener-ignore branch from 6f9a2df to 50f2740 Compare September 23, 2026 04:04
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.36%. Comparing base (a2a064c) to head (9401849).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #66224   +/-   ##
=======================================
  Coverage   90.36%   90.36%           
=======================================
  Files         792      792           
  Lines      275386   275386           
  Branches    52775    52773    -2     
=======================================
  Hits       248843   248843           
+ Misses      16979    16972    -7     
- Partials     9564     9571    +7     
Files with missing lines Coverage Δ
lib/internal/vfs/providers/real.js 95.68% <100.00%> (ø)

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikr
trivikr force-pushed the vfs-watchfile-listener-ignore branch from dc9c13b to 1cf3d97 Compare September 23, 2026 06:12
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 23, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

fs.watchFile() on a path served by a real-directory mount dispatches
to RealFSProvider.watchFile(), which ignored the supplied listener and
registered an empty function instead. The user callback never fired
after the file changed, and fs.unwatchFile(path, listener) could not
match the anonymous stub, so the stat watcher's poll timer stayed
registered and kept the process alive.

Accept the listener and pass it through to fs.watchFile() so the
callback fires on change and unwatchFile() removes it by identity.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: opencode
@trivikr
trivikr force-pushed the vfs-watchfile-listener-ignore branch from 1cf3d97 to 9401849 Compare September 27, 2026 21:20
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr
trivikr requested a review from mcollina September 28, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. vfs Issues and PRs related to the virtual filesystem subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants