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

[HttpKernel] [Profiler] High concurrency access to mkdir($this->folder) leads to warning in FileProfilerStorage #16258

Copy link
Copy link
Closed
@abienvenu

Description

@abienvenu
Issue body actions

I sometimes get this warning :

request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: mkdir(): File exists" at [...]/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php line 45 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: mkdir(): File exists at [...]/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php:45)"} []

This happens when calling multiple Symfony web pages at the same time, while Symfony just had its cache cleared.
Actually this code is not atomic :

        if (!is_dir($this->folder)) {
            mkdir($this->folder, 0777, true);
        }

Nothing prevents the directory from being created twice.

It is not a big issue, since the error will happen only if profiler is enabled, and at most once after each cache:clear.

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.