Skip to content

[Bug] Windows 上 Node 插件 SDK 保存状态时 fsync 返回 EPERM #229

Done

Description

@WhiteZeek

Platform / 平台

Windows

Area / 模块

Extensions / 扩展

Lithe version / Lithe 版本

@lithe/plugin-sdk 0.5.0,Lithe-core-rust d426f018065c950754140295e857bc71b870139f。

Priority / 优先级

P1 / 尽快处理:使用体验大幅下降,但通常仍可继续使用

OS and architecture / 操作系统与架构

Windows 11 x64,build 22631。

Environment / 环境信息

Node.js v24.14.0 x64,NTFS。使用官方 Node SDK 自带的测试和可写临时目录。

Steps to reproduce / 复现步骤

  1. 在 Windows 检出上述 Core 修订。
  2. 在仓库根运行 node --test --test-name-pattern "state store" shared/plugins/sdk/node/test/support.test.mjs。
  3. 检查首次写入和重新打开状态存储的结果。

Expected behavior / 预期行为

StateStore.write 将完整值写入临时文件,刷新到磁盘并原子替换目标。重新打开存储后能读回该值。

Actual behavior / 实际行为

覆盖状态存储的 3 个测试中,2 个在保存合法值时失败。SDK 写完临时文件后将它按只读模式重新打开,并将这个只读句柄传给 fsyncSync。Windows 返回 EPERM,写入在替换目标文件之前中止。使用同一个可写句柄写入和刷新,可在本机通过上述测试。

Logs or diagnostic output / 日志或诊断输出

FAIL the state store writes atomically and survives reopening
FAIL the state store refuses a value JSON would drop and keeps the stored one
Error: EPERM: operation not permitted, fsync
    at fsyncSync (node:fs:1284:11)
    at StateStore.write (shared/plugins/sdk/node/src/state.mjs:93)

Screenshots or recordings / 截图或录屏

命令行测试即可复现,错误发生在文件写入阶段。

Checklist / 提交前检查

  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复报告。
  • I removed secrets and personal data from the report. / 我已从报告中移除敏感信息和个人数据。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions