Skip to content

vfs: fix VirtualReadStream race with async iteration#64394

Open
Y1D7NG wants to merge 1 commit into
nodejs:mainfrom
Y1D7NG:fix-vfs-readstream-construct
Open

vfs: fix VirtualReadStream race with async iteration#64394
Y1D7NG wants to merge 1 commit into
nodejs:mainfrom
Y1D7NG:fix-vfs-readstream-construct

Conversation

@Y1D7NG

@Y1D7NG Y1D7NG commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes: #64377

VirtualReadStream opened files on the next tick without _construct, so for-await and pipeline could read before the fd was ready and fail with EBADF. Open the virtual file in _construct instead, matching fs.ReadStream.

Fixes: nodejs#64377
Signed-off-by: y1d7ng <y1d7ng@yeah.net>
@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 Jul 9, 2026
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (8fec65d) to head (31569ec).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64394   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files         741      741           
  Lines      241207   241196   -11     
  Branches    45430    45436    +6     
=======================================
- Hits       217698   217693    -5     
+ Misses      15084    15071   -13     
- Partials     8425     8432    +7     
Files with missing lines Coverage Δ
lib/internal/vfs/streams.js 95.32% <100.00%> (-0.15%) ⬇️

... and 26 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.

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.

VirtualReadStream does not work with pipeline from node:stream/promises

2 participants