question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows: EBUSY: resource busy or locked

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
summatixcommented, Apr 29, 2020

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.

0reactions
darinspiveycommented, Oct 2, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found