Windows: EBUSY: resource busy or locked
See original GitHub issueI’m setting up logdna-agent on a Windows machine for a log file that is continuously written to. The program will often open the file and write to it. The writing causes a lock which interferes with reading the file’s contents.
Unfortunately this leads to logdna-agent failing with the error "0700 [error] tail error: [FILE]: Error: EBUSY: resource busy or locked, open '[FILE]'
.
I can replicate this in PowerShell using Get-Content [FILE] -Wait
. This will stream contents until the program generating the log locks the file, causing the PowerShell command to fail.
I would expect logdna-agent to not throw an error when the file is locked and instead wait until the file isn’t locked and the contents can be read.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Error: EBUSY: resource busy or locked, rmdir - Stack Overflow
The main reason you are seeing this error is due to a program putting a lock on the folder for whatever reason ...
Read more >npm Error : EBUSY resource busy or locked #13461 - GitHub
In Windows 10 64-bit OS, I have resolved this issue by uninstalling Anti-Malware software. 29
Read more >Error: EBUSY: resource busy or locked when running "npm ...
I have tried all the solutions available via Google (clean cache, restart Windows, reinstall NPM, add exception for Windows Defender for the ...
Read more >Resolved - com.unity.timeline: EBUSY: resource busy or locked
When installing FBX exporter from unity package manager, I got this issue: [Package Manager Window] Cannot perform upm operation: Unable to ...
Read more >EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'] maybe ...
Strange issue with reading files cyclic from a local drive on windows [Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'] maybe [red] Uncaught ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The error seems to be getting thrown here: https://github.com/logdna/logdna-agent/blob/master/lib/file-utilities.js#L134
I believe what is happening is that the program is actually erasing all previous contents of the log and then writing to the same file again.
Hey guys, sorry this is a late reply, but we’re doing some re-organization of this project and addressing some bugs. On that note, we have completely re-written the existing “tail” logic to be a lossless, fault tolerant implementation. Stay tuned soon for the announcement of what will be called
@logdna/tail-file
(we are open sourcing this solution for the public).For now, in an effort to clean up these issues before doing some re-organizing, I’m going to go ahead and close this, but we certainly appreciate the discussion around this. If this is still a problem with the new implementation, the suggested fix to tolerate
EBUSY
can be easily implemented.