[Windows] fdatasyncSync on read-only fd throws EPERM, blocks node credential snapshot (canonicalIdentityLock.js)

オープン 初心者向け
#623 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@scui73414-bot がすでに取り組んでいます。

2026年9月22日 から。

  • #634 @scui73414-bot による — オープン
  • #636 @Thy985 による — マージされずにクローズ

評価

難易度
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

  1. On Windows, clone and npm install.
  2. Run node index.js (or --loop).
  3. 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分
マージ済み PR(30日)
1

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

EvoMap/evolver のほかの issue

EvoMap/evolver の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。