{"action":"created","issue":{"url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/19","repository_url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream","labels_url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/19/comments","events_url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/19/events","html_url":"https://github.com/Rcomian/bunyan-rotating-file-stream/issues/19","id":314398767,"number":19,"title":"Race condition while rotating logs: EPERM: operation not permitted, stat","user":{"login":"rdbr","id":1547982,"avatar_url":"https://avatars0.githubusercontent.com/u/1547982?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbr","html_url":"https://github.com/rdbr","followers_url":"https://api.github.com/users/rdbr/followers","following_url":"https://api.github.com/users/rdbr/following{/other_user}","gists_url":"https://api.github.com/users/rdbr/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbr/subscriptions","organizations_url":"https://api.github.com/users/rdbr/orgs","repos_url":"https://api.github.com/users/rdbr/repos","events_url":"https://api.github.com/users/rdbr/events{/privacy}","received_events_url":"https://api.github.com/users/rdbr/received_events","type":"User","site_admin":false},"labels":[{"id":326526573,"url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":{"login":"Rcomian","id":684678,"avatar_url":"https://avatars1.githubusercontent.com/u/684678?v=4","gravatar_id":"","url":"https://api.github.com/users/Rcomian","html_url":"https://github.com/Rcomian","followers_url":"https://api.github.com/users/Rcomian/followers","following_url":"https://api.github.com/users/Rcomian/following{/other_user}","gists_url":"https://api.github.com/users/Rcomian/gists{/gist_id}","starred_url":"https://api.github.com/users/Rcomian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rcomian/subscriptions","organizations_url":"https://api.github.com/users/Rcomian/orgs","repos_url":"https://api.github.com/users/Rcomian/repos","events_url":"https://api.github.com/users/Rcomian/events{/privacy}","received_events_url":"https://api.github.com/users/Rcomian/received_events","type":"User","site_admin":false},"assignees":[{"login":"Rcomian","id":684678,"avatar_url":"https://avatars1.githubusercontent.com/u/684678?v=4","gravatar_id":"","url":"https://api.github.com/users/Rcomian","html_url":"https://github.com/Rcomian","followers_url":"https://api.github.com/users/Rcomian/followers","following_url":"https://api.github.com/users/Rcomian/following{/other_user}","gists_url":"https://api.github.com/users/Rcomian/gists{/gist_id}","starred_url":"https://api.github.com/users/Rcomian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rcomian/subscriptions","organizations_url":"https://api.github.com/users/Rcomian/orgs","repos_url":"https://api.github.com/users/Rcomian/repos","events_url":"https://api.github.com/users/Rcomian/events{/privacy}","received_events_url":"https://api.github.com/users/Rcomian/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-04-15T09:06:22Z","updated_at":"2018-04-18T20:41:02Z","closed_at":null,"author_association":"NONE","body":"I have been using the rotating file stream for a long time successfully, but I think there is a race condition when files are getting rotated and zipped.\r\n\r\nMy application crashed with the following error:\r\n`Error: EPERM: operation not permitted, stat 'C:\\path\\to\\log\\test-2018-04-09.log'`\r\n\r\nThe directory shows that `C:\\path\\to\\log\\test-2018-04-09.log.gz` was created successfully and the `test-2018-04-09.log` was deleted. It should not have tried to access the old, deleted, log file.\r\n\r\nBelow is my init code. I didn't receive an error event, it just crashed.\r\n```\r\n    // Create logger\r\n    this.logger = bunyan.createLogger({\r\n      name: 'test',\r\n      streams: [{\r\n        type: 'raw',\r\n        level: 'info',\r\n        stream: new RotatingFileStream({\r\n          path: filePath + '-%Y-%m-%d-%N.log',\r\n          threshold: '350m',\r\n          gzip: true\r\n        })\r\n      }]\r\n    });\r\n    \r\n    this.logger.on('error', (error, stream) => {\r\n      console.log('Logger error: ' + error.message);\r\n    });\r\n```"},"comment":{"url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/comments/382522260","html_url":"https://github.com/Rcomian/bunyan-rotating-file-stream/issues/19#issuecomment-382522260","issue_url":"https://api.github.com/repos/Rcomian/bunyan-rotating-file-stream/issues/19","id":382522260,"user":{"login":"rdbr","id":1547982,"avatar_url":"https://avatars0.githubusercontent.com/u/1547982?v=4","gravatar_id":"","url":"https://api.github.com/users/rdbr","html_url":"https://github.com/rdbr","followers_url":"https://api.github.com/users/rdbr/followers","following_url":"https://api.github.com/users/rdbr/following{/other_user}","gists_url":"https://api.github.com/users/rdbr/gists{/gist_id}","starred_url":"https://api.github.com/users/rdbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdbr/subscriptions","organizations_url":"https://api.github.com/users/rdbr/orgs","repos_url":"https://api.github.com/users/rdbr/repos","events_url":"https://api.github.com/users/rdbr/events{/privacy}","received_events_url":"https://api.github.com/users/rdbr/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T20:41:02Z","updated_at":"2018-04-18T20:41:02Z","author_association":"NONE","body":"Maybe it is a different problem.\r\nCould it be a naming conflict if I have two loggers with these names, so the prefix includes a `-`:\r\n`test-%Y-%m-%d-%N.log`\r\n`test-test2-%Y-%m-%d-%N.log`\r\n\r\nDuring rotation, maybe the wrong file is rotated."}}
{"actor":{"display_login":"rdbr"}}