Describe the bug
In Kubernetes environments Pods might be terminated and shifted to other Nodes. Because of this the configured log path might be in use if the old Pod is about to terminate and the new one is starting up. To use the same LogFileLock it might be good to implement a retry attempt for the new Pod which is trying to acquire the lock.
To Reproduce
Steps to reproduce the behavior:
In Kubernetes create a Job which executes an application inside a Pod
Set the Job to recreate the Pod on deletion
Delete the running Pod which is causing the Pod to be in the "Terminating" state while the new one is started
You will see that the old Pod is holding the Lock as long it is not terminated, but the new Pod is trying to acquire the lock
Describe the bug In Kubernetes environments Pods might be terminated and shifted to other Nodes. Because of this the configured log path might be in use if the old Pod is about to terminate and the new one is starting up. To use the same LogFileLock it might be good to implement a retry attempt for the new Pod which is trying to acquire the lock.
To Reproduce Steps to reproduce the behavior:
Additional context I provide a PR.