Description
Q | A |
---|---|
Bug report? | yes |
Patch? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.2 |
The problem occurs when the amount of cache generated is such that writing is no longer possible on the HttpCache (e.g dedicated disk, my case).
More precisely, the temporary file created by tempnam can no longer be moved to the HttpCache cache folder.
Until then everything is not going so bad, the cache is not created but the page is displayed correctly.
Symfony/Component/HttpKernel/HttpCache/Store.php The case is provided line 412
if (false === @rename($tmpFile, $path)) {
return false;
}
The tempnam function creates a unique temporary file for each call to a page to be cached, and if the temporary folder passed as an argument is not writable, tempnam will use /tmp.
Note: If PHP cannot create a file in the specified dir parameter, it falls back on the system default. On NTFS this also happens if the specified dir contains more than 65534 files.
http://php.net/manual/en/function.tempnam.php
Therefore, as soon as the HttpCache cache is no longer writable, the /tmp fills up fairly quickly, tempnam being called on every page (since no page cache) and creating a new unique file in /tmp.
Patch:
I propose to delete the temporary file $tmpFile. It will not fix the space problem for the cache but it will no longer fill the server /tmp and will not crash the instance anymore:
Thx!