wilcard-file-reader: Fix detection of file delete/move when using ivykis poll events#4998
Merged
HofiOne merged 29 commits intosyslog-ng:masterfrom Jul 16, 2024
Conversation
Contributor
|
Build FAILURE |
07238c9 to
41bfd3a
Compare
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 13, 2024
Signed-off-by: Hofi <[email protected]>
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 17, 2024
Signed-off-by: Hofi <[email protected]>
9f066f8 to
2ba0367
Compare
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 17, 2024
Signed-off-by: Hofi <[email protected]>
2ba0367 to
70942b0
Compare
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 18, 2024
Signed-off-by: Hofi <[email protected]>
70942b0 to
fc67fe9
Compare
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 22, 2024
Signed-off-by: Hofi <[email protected]>
fc67fe9 to
1d92aed
Compare
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 24, 2024
Signed-off-by: Hofi <[email protected]>
ed5699a to
0a7e0b1
Compare
Contributor
|
Build FAILURE |
HofiOne
added a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 24, 2024
Signed-off-by: Hofi <[email protected]>
f8a2eee to
298063b
Compare
Contributor
|
Build FAILURE |
4ca3b23 to
c1d4e4b
Compare
Contributor
|
Build FAILURE |
Signed-off-by: Hofi <[email protected]>
Also, added a one-time work trigger function if a work is not in progress already Checking the reader openness is public now. Signed-off-by: Hofi <[email protected]>
Update watches reschedule the io handlers only if the new poll checker resulting to true Signed-off-by: Hofi <[email protected]>
… on file deleted exit flow for all the poll readers Signed-off-by: Hofi <[email protected]>
…tect reader liveness and forwarding now all the pipe notifications Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
Also, added the poll events fn getter Signed-off-by: Hofi <[email protected]>
…_freq Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
…to create collection entry hashes to detect file renaming as well Signed-off-by: Hofi <[email protected]>
… (preparation of test modifications) Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
…aders Do not use a direct file reload on filemoved detected in the ivikys file poll, it can lead to multiple processing of the same file. Directory monitor can notify now correctly about a file move, use the same notification and processing flow in every case. Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>
b984dfa to
9e32406
Compare
Contributor
|
Build FAILURE |
fe88ef4 to
9cedf9a
Compare
Contributor
|
Build FAILURE |
Collaborator
Author
|
@kira-syslogng test this please; |
…an in progress work item Signed-off-by: Hofi <[email protected]>
9cedf9a to
d20281f
Compare
kovgeri01
approved these changes
Jul 16, 2024
HofiOne
added a commit
to syslog-ng/syslog-ng.github.io
that referenced
this pull request
Jul 16, 2024
Added the new monitor-freq() option description Documentation of syslog-ng/syslog-ng#4998 Signed-off-by: Hofi [[email protected]](mailto:[email protected])
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.
This PR has the following changes:
Fixes a crash in log pipe queue during file deletion and EOF detection
The crash was caused by a concurrency issue in the EOF and file deletion detection when using a
wildcard-file()source.If a file is written after being deleted (e.g. with an application keeping the file open), or if these events happen concurrently, the file state change poller mechanism might schedule another read cycle even though the file has already been marked as fully read and deleted.
To prevent this re-scheduling between these two checks, the following changes have been made:
Instead of maintaining an internal EOF state in the
WildcardFileReader, when a file deletion notification is received, the poller will be signaled to stop after reaching the next EOF. Only after both conditions are set the reader instance will be deleted.Fixes: syslog-ng 3.24.1 sometimes crash in log_pipe_queue #4989
The fix is inspired by @MrAnno's #160
Fixed the file deletion and removal detection when the
file-readerusespoll_fd_eventsto follow file changes, which were mishandled. For example, files that were moved or deleted (such as those rolled by a log-rotator) were read to the end but never read again if they were not touched anymore, therefore switching to the new file never happened.Added a dedicated
monitor_freqoption to control the poll frequency of the change detection in the directories separately when thepollmethod is selected via themonitor-method()option.The
monitor-method()option controls only the change detection method in the directories, not the following of the file changes, and ifpollis the selected method the frequency must not necessarily be the same, e.g. if the (earlier) commonly usedfollow-freq()is set to 0 for switching to thepoll_fd_eventsmethod for file content change detection, that also might be meant a directory change poll with zero delays (ifmonitor-method()was set topollas well), and that could cause a heavy CPU load unnecessarily.Documented in syslog-ng/syslog-ng.github.io#101
Signed-off-by: Hofi [email protected]