Skip to content

File space leak in the lock provider #39826

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

Open
5 tasks
Sgeleon2000 opened this issue Apr 17, 2025 · 2 comments
Open
5 tasks

File space leak in the lock provider #39826

Sgeleon2000 opened this issue Apr 17, 2025 · 2 comments
Labels
Issue: ready for confirmation Reported on 2.4.7 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Sgeleon2000
Copy link

Preconditions and environment

  • Magento version 2.4.7

Steps to reproduce

When using file mode in the file lock provider, the system does not remove the file after use. If there are many variations of the cache hash, the directory size can become very large.

Expected result

The directory where cache files are saved should be small.

Actual result

If there are many variations of the cache hash, the directory size can become very large.

Additional information

To fix this, we can use the following patch:

Index: vendor/magento/framework/Lock/Backend/FileLock.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/framework/Lock/Backend/FileLock.php b/vendor/magento/framework/Lock/Backend/FileLock.php
--- a/vendor/magento/framework/Lock/Backend/FileLock.php
+++ b/vendor/magento/framework/Lock/Backend/FileLock.php	(date 1738945943083)
@@ -147,6 +147,9 @@

         if (isset($this->locks[$lockFile]) && $this->tryToUnlock($this->locks[$lockFile])) {
             unset($this->locks[$lockFile]);
+
+            $this->fileDriver->deleteFile($lockFile);
+
             return true;
         }


Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Copy link

m2-assistant bot commented Apr 17, 2025

Hi @Sgeleon2000. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@github-project-automation github-project-automation bot moved this to Ready for Confirmation in Issue Confirmation and Triage Board Apr 17, 2025
@engcom-Bravo engcom-Bravo added Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Reported on 2.4.7 Indicates original Magento version for the Issue report. labels Apr 17, 2025
@hostep
Copy link
Contributor

hostep commented Apr 17, 2025

#39372 already fixes this. It didn't get merged in time to be shipped with Magento 2.4.8, so it will be for Magento 2.4.9 next year unfortunately.

There are also some interesting finds documented in #39369, like this change: 65d8985 (which we reverted in a custom patch on our shops to keep lock files under control and having these block generation locks still use the database locking mechanism like how it was in Magento 2.4.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation Reported on 2.4.7 Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Ready for Confirmation
Development

No branches or pull requests

3 participants