Skip to content

[Cache] Remove temporary cache item file on rename() failure #52105

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

Merged
merged 1 commit into from
Oct 17, 2023
Merged

[Cache] Remove temporary cache item file on rename() failure #52105

merged 1 commit into from
Oct 17, 2023

Conversation

cedric-anne
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #52092
License MIT

The filesystem cache adapter creates a temporary file to store cache item data, then moves it to its target path using rename() function. If rename fails, for instance target path is not writable, the temporary file will remains.

To prevent filesystem saturation, the temporary files should be deleted if this operation is not done by the rename() function itself.

@cedric-anne cedric-anne marked this pull request as ready for review October 17, 2023 12:01
@carsonbot carsonbot added this to the 5.4 milestone Oct 17, 2023
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a slightly different implementation, can you please confirm it works for you?

@cedric-anne
Copy link
Contributor Author

I pushed a slightly different implementation, can you please confirm it works for you?

I confirm it fixes the issue.

@symfony symfony deleted a comment from carsonbot Oct 17, 2023
@nicolas-grekas
Copy link
Member

Thank you @cedric-anne.

@nicolas-grekas nicolas-grekas merged commit 8c02677 into symfony:5.4 Oct 17, 2023
@cedric-anne cedric-anne deleted the fix/delete-cache-tmp-file branch October 17, 2023 14:41
@fabpot fabpot mentioned this pull request Oct 21, 2023
@fabpot fabpot mentioned this pull request Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants