[IO-528] fix Tailer.run race condition runaway logging#29
Closed
davidmoten wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
No idea why the travis build didn't start. Perhaps an administrator can restart the build. |
Contributor
Author
|
Looking at our logging history this runaway logging has occurred about 20 times in 4 months (but was restricted to <1GB of extra logs each time as the file in question presumably reappeared). The critical day produced 145GB and system crashed. I didn't mention earlier that this occurred on Unix. I imagine that this might not happen on Windows because it would have a lock on the file and prevent the other process deleting it. |
Contributor
Author
|
No response yet, I'm a bit surprised as the effect of this bug is pretty nasty. |
Contributor
|
Thanks! 👍 And sorry for the delay. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tailer.runhas a race condition that can have serious effects.The
run()method has two while loops. The first waits till the file exists and the second loop reads lines from the file doing some file rotation checking on the way. If the file is deleted while the second loop is in progress then the loop goes crazy logging warnings that look like this:In our case this had serious effects. The file being tailed was deleted by another process and all available disk space was rapidly used up by the logging. This crashed a system.
The fix is to put a sleep after the call to
fileNotFound().I haven't made a unit test because reliably triggering this problem would involve a major refactor of the
runmethod to make it testable.