Skip to content
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

wildcard-file: fix race between EOF and file deletion detection #160

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

MrAnno
Copy link
Member

@MrAnno MrAnno commented Jun 10, 2024

This patch fixes a "race condition" between the EOF and file deletion
detection of AxoSyslog when wildcard-file() is used.

If a file is written after being deleted (an application keeps an fd
open), or if these two events occur concurrently, nearly at the same
time, the file poller mechanism might schedule another read cycle while
the file has already been marked as fully read and deleted.

To avoid scheduling issues between the two checks, the following is done
from now on: We do not track the EOF state in the WildcardFileReader,
instead, when a file deletion notification is received, the poller will
be instructed to stop after reaching the next EOF, and only then will
AxoSyslog actually delete the reader instance.

Fixxes syslog-ng/syslog-ng#4989

MrAnno added 2 commits June 10, 2024 20:09
This patch fixes a "race condition" between the EOF and file deletion
detection of AxoSyslog when wildcard-file() is used.

If a file is written after being deleted (an application keeps an fd
open), or if these two events occur concurrently, nearly at the same
time, the file poller mechanism might schedule another read cycle while
the file has already been marked as fully read and deleted.

To avoid scheduling issues between the two checks, the following is done
from now on: We do not track the EOF state in the WildcardFileReader,
instead, when a file deletion notification is received, the poller will
be instructed to stop after reaching the next EOF, and only then will
AxoSyslog actually delete the reader instance.

Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
@alltilla alltilla merged commit 1a3c959 into axoflow:main Jun 13, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants