-
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
in_tail: avoid locking files on Windows #1159
Conversation
Previously, flb_tail_file_append() used POSIX open(2) to open log files. The problem with this approach was that it silently acquires a delete lock on the file, and thus can interfere with file maintenance operations performed by the logging process (like log file rotation). PS > rm access.log rm : cannot remove item access.log: The access cannot access the file 'access.log' because it is being used by another process. This patch resolves the issue by using CreateFile() instead of POSIX open() and enabling resource sharing (FILE_SHARE_*) explicitly. Signed-off-by: Fujimoto Seiji <[email protected]>
@fujimotos we tried the latest rc release and we are getting constant file locking when using the fluent-bit windows on Kubernetes. When a windows pod gets deleted, the pod stays in Terminating State for ever until we delete the fluent bit pod running on the same node. The error in Kubelet shows that the log file associated to the deleted pod cannot be found / or is unaccessible. |
@djsly That's weird. This patch is for It sounds to me that your issue is not directly related to this patch, but due to the Can you provide the following information so that I investigate the issue a bit more?
|
@fujimotos sure, I will let @titilambert create a new issue with the latest config. we can reproduce quite easily, so that's a good thing |
Hello @fujimotos Sorry for the delay, I'm using the latest windows version from the PR thread. Here the configuration:
Here the logs:
When I delete a windows pod, the pods stays in Terminating
When I delete the fluentbit windows pod, the telegraf windows stops correctly Thanks ! |
@fujimotos do you prefer a new issue for that ? |
@titilambert Thank you. I created a new issue #2027 to track this bug. |
Previously, flb_tail_file_append() used POSIX open(2) to open log files.
The problem with this approach was that it silently acquires a delete
lock on the file, and thus can interfere with file maintenance operations
performed by the logging process (like log file rotation).
This patch resolves the issue by using CreateFile() instead of POSIX open()
and enabling resource sharing (FILE_SHARE_*) explicitly.
This patch is intended to be merged after v1.1 release
Part of #960