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

Cache FileHandler unlink exception #2579

Merged
merged 1 commit into from
Feb 20, 2020

Conversation

MGatner
Copy link
Member

@MGatner MGatner commented Feb 20, 2020

Description
Currently the cache FileHandler checks for the existence of the file, reads its contents, then if the TTL has expired it removes the file. Because of the disk operation to read the file and unserialize its contents it is conceivable (and has happened to me a few times) that concurrent calls actually interlace the removal of the file between its check and the second removal attempt, leading to an exception when it tries to unlink the non-existent file. This PR adds a second check to confirm the file still exists, which should ensure no two calls attempt to remove the same file.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@MGatner MGatner requested a review from lonnieezell February 20, 2020 17:47
@MGatner MGatner merged commit a709ec5 into codeigniter4:develop Feb 20, 2020
@MGatner MGatner deleted the cache-unlink branch November 28, 2020 18:45
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