-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
File source after deletion and writing again not working properly #15885
Comments
What a timing. This morning we just experienced a "too many open files" OS error coming from Vector on a file-based pipeline that also is supposed to be deleting old files. We discovered that indeed Vector did not delete all the files it should and exhausted the open files limit of the OS. The end effect is that lots of old files were left on the server and the disk started to fill up. |
I can only reproduce this issue if I run the same If I run this command: for i in {1..101}; do echo "abc: $(date +%s.%N)" >> 1.txt; done; rm 1.txt; for i in {1..101}; do echo "cde: $(date +%s.%N)" >> 1.txt; done; this problem does not seem to occur, since no two files will ever have the same fingerprint. It's likely the problem is caused because
Since the fingerprint hasn't changed, Vector doesn't realise that this is a new file so it keeps the file handle to the deleted file open. I'm not sure if there is a solution here. Real world cases should not be creating files with the same fingerprint. |
@hhromic Is it possible you are creating multiple files with the same fingerprint? |
Hi @StephenWakely, thanks for investigating this!
We are using the following configuration: fingerprint:
strategy: checksum
lines: 7
ignored_header_bytes: 5 However, we are processing gzipped files and as I reported in #13193, the checksum fingerprinter has issues on compressed data. After what you reported, now I'm thinking that this issue (for us) might be related to the one I reported for gzipped data. Is there a way for me to verify that Vector is seeing the same fingerprints to answer your question? |
I just realised that the entity deleting the files in our case is Vector itself (configured to do so in the Therefore, it seems our issue is actually different than the one in this report :(. |
This issue happens indeed due to the fingerprint. We have similar issue in our production environment. Will check whether it happens due to the checksum equality. Thank you @StephenWakely! |
A note for the community
Problem
After file removal and immediate create and write again, vector may keep file for delition and does not see any new input for this file.
Way to reproduce the bug with the configuration, attached below
cd /tmp
for i in {1..101}; do echo "abc: $i" >> 1.txt; done; rm 1.txt; for i in {1..10100}; do echo "cde: $i" >> 1.txt; done;
This is the case when vector did not release the file.
If you see no held files, try again from step 2. Usually we need 2-3 attempts to get file not released by vector.
After this happens, vector does not see any input from this file:
Note, this is the last line before file was dropped. No data from new file is presented in output log
Configuration
The text was updated successfully, but these errors were encountered: