-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Error on rotated file if new file takes time to appear #22
Conversation
The test for memory consumption creates a large log file. Previously, it was creating it in the local test directory which clutters up the project dir and could potentially get committed. This change restructures the test to use a temp directory as given by the OS. Semver: patch
I'll look at this today. |
b6978bb
to
dc4dd2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking good, I've added a minor remark below.
I think there's a small race condition on _readRemainderFromFileHandle()
that might be more likely to appear now: we are nullifying the file handle field after async reading/closing of the file handle (other events/timers can occur in the meantime). Instead, we could store the reference to the file handle locally, set the property to null and then do the async ops.
d0d8cb4
to
652e0bd
Compare
When a file's inode changes, or the `stat` call throws causes tail-file to read the remainder of the contents via a FileHandle. If the file disappears, but takes a bit to re-appear, `_readRemainderFromFileHandle()` is erroneously called twice; once for the `ENOENT` from the disappearing file, and once when the new file causes the inode to change. This commit fixes a bug where the FH is nullified after the first call, and thus throws on the subsequent call. Semver: patch Fixes: #18
652e0bd
to
3576bd4
Compare
fix: Error on rotated file if new file takes time to appear
When a file's inode changes, or the
stat
call throwscauses tail-file to read the remainder of the contents
via a FileHandle. If the file disappears, but takes a bit
to re-appear,
_readRemainderFromFileHandle()
iserroneously called twice; once for the
ENOENT
from thedisappearing file, and once when the new file causes the
inode to change. This commit fixes a bug where the FH is
nullified after the first call, and thus throws on the
subsequent call.
Semver: patch
Fixes: #18
refactor: memory-usage tests should use a temp directory
The test for memory consumption creates a large log file.
Previously, it was creating it in the local test directory
which clutters up the project dir and could potentially
get committed. This change restructures the test to use
a temp directory as given by the OS.
Semver: patch
deps: tap@15.0.9
deps: eslint-config-logdna@5.1.0
deps: eslint@7.27.0