[Windows] fdatasyncSync on read-only fd throws EPERM, blocks node credential snapshot (canonicalIdentityLock.js)
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, nodejs
- 领域
- backend
调研方向
从 src/canonicalIdentityLock.js 的 prepareOwnerFile() 开始,检查 fs.fdatasyncSync() 之前使用的 descriptor mode。在 Windows 上使用 node index.js 或 --loop 复现;完成的标准是 canonical node-credential snapshot 和 node registration/hello handshake 能够在没有 EPERM 错误的情况下持久化 credentials。
由索引模型根据 Issue 内容生成。
描述
Summary
On Windows, src/canonicalIdentityLock.js opens the owner file in read-only mode and then calls fs.fdatasyncSync() on that descriptor. Windows' fdatasync (backed by FlushFileBuffers) requires a writable handle, so a read-only fd throws EPERM: operation not permitted, fdatasync. This breaks the canonical node-credential snapshot, so node registration / hello handshake cannot persist credentials.
Steps to reproduce
- On Windows, clone and
npm install. - Run
node index.js(or--loop). - Observe the non-fatal errors:
[a2aProtocol] Failed to snapshot canonical node credentials: EPERM
[TaskReceiver] Fetch/claim failed (non-fatal): EPERM: operation not permitted, fdatasync
Minimal repro:
const fs = require('fs');
fs.writeFileSync('x', 'hello');
const fd = fs.openSync('x', 'r'); // read-only
fs.fdatasyncSync(fd); // throws EPERM on Windows
Root cause
src/canonicalIdentityLock.js, prepareOwnerFile():
descriptor = fs.openSync(preparedOwnerFile, 'r'); // read-only
fs.fdatasyncSync(descriptor); // EPERM on win32
fdatasync on a read-only fd is tolerated on Linux/macOS but fails on Windows (FlushFileBuffers -> ERROR_ACCESS_DENIED -> EPERM).
Suggested fix
Open read+write so fdatasync has a writable handle:
descriptor = fs.openSync(preparedOwnerFile, 'r+');
fs.fdatasyncSync(descriptor);
Environment
- OS: Windows (win32)
- Node.js: v22.22.2
- Evolver version: 1.94.0
- 主要语言
- JavaScript
- 星标
- 9.1k
- 派生
- 848
- 平均合并
- 14 小时 39 分钟
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EvoMap/evolver 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 3/5 1-2 天 新手友好度 72/100
相似的 Issue
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10可能已有人在做 @goranai 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
NL-BioImaging/OMERO.biomero#92 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
LinkNacional/woo-rede#367 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
bug Next.js
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-wizard#1397 · 1 条评论 ·
维护者通常 1 天内回复