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

SHARYANTO::File::Flock unlink-related race conditions #1

Closed
andersk opened this issue Jun 1, 2013 · 1 comment
Closed

SHARYANTO::File::Flock unlink-related race conditions #1

andersk opened this issue Jun 1, 2013 · 1 comment

Comments

@andersk
Copy link

andersk commented Jun 1, 2013

In SHARYANTO::File::Flock, your redo TRY logic is written incorrectly. If $path has been unlinked by another process, then @st2 will become empty, but your code fails to redo TRY in that case and incorrectly returns success.

Additionally, you have to be more careful never to unlink the lockfile while the current process doesn’t have it locked. That may happen in your code if release or unlock is called before the object is destroyed.

@perlancar
Copy link
Owner

Thanks, I've handled the case when @st2 is empty. commit:be6ae65

Also, file is now unlinked only when current process is holding the lock. commit:6bd9753

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

No branches or pull requests

2 participants