Title: vfs: memory provider serves stale content and size to already-open handles · Issue #66355 · nodejs/node · GitHub
Open Graph Title: vfs: memory provider serves stale content and size to already-open handles · Issue #66355 · nodejs/node
X Title: vfs: memory provider serves stale content and size to already-open handles · Issue #66355 · nodejs/node
Description: Version main Platform All Subsystem vfs What steps will reproduce the bug? import { create } from 'node:vfs'; const { provider: p } = create(); p.writeFileSync('/f', 'AAAA'); const h = p.openSync('/f', 'r'); p.writeFileSync('/f', '012345...
Open Graph Description: Version main Platform All Subsystem vfs What steps will reproduce the bug? import { create } from 'node:vfs'; const { provider: p } = create(); p.writeFileSync('/f', 'AAAA'); const h = p.openSync('...
X Description: Version main Platform All Subsystem vfs What steps will reproduce the bug? import { create } from 'node:vfs'; const { provider: p } = create(); p.writeFileSync('/f', 'AAAA')...
Opengraph URL: https://github.com/nodejs/node/issues/66355
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"vfs: memory provider serves stale content and size to already-open handles","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nAll\n```\n\n### Subsystem\n\nvfs\n\n### What steps will reproduce the bug?\n\n```js\nimport { create } from 'node:vfs';\n\nconst { provider: p } = create();\np.writeFileSync('/f', 'AAAA');\nconst h = p.openSync('/f', 'r');\n\np.writeFileSync('/f', '0123456789');\n\nconst b = Buffer.alloc(10);\nconsole.log('readSync:', h.readSync(b, 0, 10, 0), JSON.stringify(b.subarray(0, 4).toString()));\nconsole.log('readFileSync:', JSON.stringify(h.readFileSync('utf8')));\nconsole.log('fstat:', h.statSync().size, 'stat:', p.statSync('/f').size);\nh.readFile('utf8').then((s) => console.log('readFile:', JSON.stringify(s)));\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe already-open descriptor should observe the file's current content and size. On a real filesystem an open descriptor is a live view of the inode, not a snapshot.\n\n### What do you see instead?\n\n```console\nreadSync: 4 \"AAAA\"\nreadFileSync: \"AAAA\"\nfstat: 4 stat: 10\nreadFile: \"0123456789\"\n```\n\nThe pre-existing handle keeps serving the bytes that were in the file when it was opened: `readSync`/`read`/`readFileSync` are stale, `fstat` reports the pre-mutation size, and the async `readFile` disagrees with the sync `readFileSync` on the very same handle.\n\n### Additional information\n\nfs equivalent\n\n```js\nimport { writeFileSync, openSync, readSync, readFileSync, fstatSync, statSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\nconst file = join(tmpdir(), 'vfs-native-repro.txt');\n\nwriteFileSync(file, 'AAAA');\nconst fd = openSync(file, 'r');\nwriteFileSync(file, '0123456789');\n\nconst b = Buffer.alloc(10);\nconsole.log('readSync:', readSync(fd, b, 0, 10, 0), JSON.stringify(b.subarray(0, 4).toString()));\nconsole.log('readFileSync:', readFileSync(fd, 'utf8'));\nconsole.log('fstatSync:', fstatSync(fd).size, 'stat:', statSync(file).size);\n```\n\nOutput\n```console\nreadSync: 10 \"0123\"\nreadFileSync: 0123456789\nfstatSync: 10 stat: 10\n```","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-09-27T17:39:36Z","url":"https://github.com/nodejs/node/issues/66355"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:067257a1-6515-1128-5858-99d8f28915b0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF20:937F2:2B7AF52:399956D:6B03362C |
| html-safe-nonce | 6869a22b272ee6bf59e3fc36578b17ba1c26110bbebc031314d918727cabae2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjIwOjkzN0YyOjJCN0FGNTI6Mzk5OTU2RDo2QjAzMzYyQyIsInZpc2l0b3JfaWQiOiI3MDkyMzEzNDgzNzU2Mzg1ODM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 64954018713618aac64d254e7d17bed5a12b68b7a8711c5f3869e9db52bcbfc1 |
| hovercard-subject-tag | issue:5604839711 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66355/issue_layout |
| twitter:image | https://opengraph.githubassets.com/77d53e94403fa3ef7bc34bf130a3801da8ec736e9c41dbf18eb89f0d4f3e011f/nodejs/node/issues/66355 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/77d53e94403fa3ef7bc34bf130a3801da8ec736e9c41dbf18eb89f0d4f3e011f/nodejs/node/issues/66355 |
| og:image:alt | Version main Platform All Subsystem vfs What steps will reproduce the bug? import { create } from 'node:vfs'; const { provider: p } = create(); p.writeFileSync('/f', 'AAAA'); const h = p.openSync('... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width