Compress may cause Error: EPERM: operation not permitted open 'xxx\xxxx\xxxxx\myfile'. It`s ok with the option of compress is false.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
- 领域
- backend
调研方向
从 lib/RollingFileWriteStream.js 开始,重点查看 _shouldRoll、_moveOldFiles 和 _renewWriteStream,并结合报告中的 stack trace。使用提供的 index.js、compress: true 和一个已打开的 myfile 在 Windows 上重现;当重复运行在滚动文件时不再引发 EPERM 时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
This issue is discovered from "log4js-node", The latest version of "log4js-node" has the same issue because of this dependency.
replicate step:
- Download source code of this project.
- Create a 'index.js' file in root of this project.
- Input content in 'index.js' file:
var rollers = require('./lib/index');
var stream = new rollers.RollingFileStream('myfile', 10000, 12, {
compress: true,
});
for (let i = 0; i < 30; i++) {
// console.log(i);
stream.write(getContent());
}
stream.end();
function getContent() {
return `
{
a: {a: 1, b: 2, c: 3, d: 4, e: 5, f: 123321, g: 234432432, h: 31321, i: 23232, j: 23432423432432, k: 1123321},
b: {a: 1, b: 2, c: 3, d: 4, e: 5, f: 123321, g: 234432432, h: 31321, i: 23232, j: 23432423432432, k: 1123321},
c: {a: 1, b: 2, c: 3, d: 4, e: 5, f: 123321, g: 234432432, h: 31321, i: 23232, j: 23432423432432, k: 1123321},
......... // 70000 lines repeated
}`
}
- Execute
node index.jsin terminal. - Open the hot file "myfile" with notebook or VSCode as you like. This step is very important. The issue will not replicate without this step.
- Execute
node index.jsin terminal again. If no error occur, you can execute more times. The probability is very high, more than 50%.
Finally get this error in terminal:
Error: EPERM: operation not permitted, open 'D:\nodeProgram\TEST\test-streamroller\streamroller-master\myfile'
at Object.openSync (node:fs:596:3)
at Object.writeFileSync (node:fs:2322:35)
at Object.appendFileSync (node:fs:2384:6)
at RollingFileStream._renewWriteStream (D:\nodeProgram\TEST\test-streamroller\streamroller-master\lib\RollingFileWriteStream.js:312:8)
at RollingFileStream._moveOldFiles (D:\nodeProgram\TEST\test-streamroller\streamroller-master\lib\RollingFileWriteStream.js:232:10)
at async RollingFileStream._shouldRoll (D:\nodeProgram\TEST\test-streamroller\streamroller-master\lib\RollingFileWriteStream.js:170:7) {
errno: -4048,
syscall: 'open',
code: 'EPERM',
path: 'D:\nodeProgram\TEST\test-streamroller\streamroller-master\myfile'
}
- 主要语言
- JavaScript
- 星标
- 38
- 派生
- 20
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
log4js-node/streamroller 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
log4js-node/streamroller#176 ·
-
难度 3/5 1-2 天 新手友好度 35/100
log4js-node/streamroller#173 ·
-
难度 4/5 3-5 天 新手友好度 15/100
log4js-node/streamroller#171 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
log4js-node/streamroller#163 · 3 条评论 ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
log4js-node/streamroller#120 · 1 个 reaction ·
查看 log4js-node/streamroller 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1414 ·
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·