Closed
Description
Symfony version(s) affected: 4.4.20 (I think version 5.0 and more may be affected too)
Description
On Windows, with PHP 7.4, autoload of some cache adapter files causes the following error when two concurrent requests using the cache are executed:
[2021-02-09 13:51:39] php.WARNING: Notice: include(): read of 4352 bytes failed with errno=13 Permission denied {"exception":"[object] (ErrorException(code: 0): Notice: include(): read of 4352 bytes failed with errno=13 Permission denied at C:\\[...]\\vendor\\composer\\ClassLoader.php:476)"} []
[2021-02-09 13:51:39] php.WARNING: Warning: include(): Failed opening 'C:\[...]\vendor\composer/../symfony/cache/Adapter/ArrayAdapter.php' for inclusion (include_path='.;C:\php\pear') {"exception":"[object] (ErrorException(code: 0): Warning: include(): Failed opening 'C:\\[...]\\vendor\\composer/../symfony/cache/Adapter/ArrayAdapter.php' for inclusion (include_path='.;C:\\php\\pear') at C:\\[...]\\vendor\\composer\\ClassLoader.php:476)"} []
[2021-02-09 13:51:39] php.CRITICAL: Uncaught Error: Class 'Symfony\Component\Cache\Adapter\ArrayAdapter' not found {"exception":"[object] (Error(code: 0): Class 'Symfony\\Component\\Cache\\Adapter\\ArrayAdapter' not found at C:\\[...]\\vendor\\symfony\\expression-language\\ExpressionLanguage.php:36)"} []
The adapter PHP files are locked with flock
in LockRegistry so if a callback takes to much time to generate the data to cache, the second requests executed may fail because the adaptater file is still locked by the first request and can not be included.
This issue seems to be similar to #36132 but with other files.
How to reproduce
- Clone the repository https://github.com/gdott9/flock-cache-bug
- Execute two concurrent requests to the root URL. You have to execute the second request before the first one end (there is a
sleep(5)
in the callback, so you have 5 seconds to execute the second request)