4

node.js writeFile 间歇性出现 EPERM 问题,如何 debug

 2 years ago
source link: https://www.v2ex.com/t/839970
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Node.js

node.js writeFile 间歇性出现 EPERM 问题,如何 debug

  yocoso · 10 小时 24 分钟前 · 316 次点击

这个问题困扰我们很久了, 在基于 electron 的客户端,使用 writeFile 来创建图片文件在用户本地, 但是偶尔会报错误: { "errno": -4048, "code": "EPERM", "syscall": "open", "path": "C:\Users\abc\Documents\xxxx\xxxxxx\derived50833397\IMG_20211220_045044_630.jpg" }

这个错误只出现在 windows 系统里,mac 系统没有报告。 发生在多个用户上,间歇性的。但是一旦发生,同样的错误就会连续产生。

已经排除了杀毒软件的干扰。 在写之前检查写入目录 C:\Users\abc\Documents\xxxx\xxxxxx\derived50833397 权限是 o666 。而且在这个文件之前有别的文件(非 image 文件)写入成功。 应该是有 race condition 存在,但不知道该怎么 debug 。 有没有大神指教可以考虑哪些原因?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK