Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpCache] Server Crash if there is no more space for cache HttpCache #22719

Copy link
Copy link
Closed
@Chansig

Description

@Chansig
Issue body actions
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:

httpcache.patch.txt

Thx!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.