Skip to content

3.4.1 Exclusive Lock Error with Vagrant NFS Mounts #25336

@brianfreytag

Description

@brianfreytag
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4.1

When upgrading to 3.4.1, the LOCK_EX added to the file_put_contents on line 426 of Kernel.php (#24960), creates exclusive lock issues when clearing cache and installing assets when running Symfony in a vagrant environment with nfs mounts.

$> ./bin/console cache:clear

PHP Warning:  file_put_contents(): Exclusive locks are not supported for this stream in /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php on line 426
PHP Stack trace:
PHP   1. {main}() /var/www/ledms/bin/console:0
PHP   2. Symfony\Component\Console\Application->run() /var/www/ledms/bin/console:29
PHP   3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
PHP   4. Symfony\Component\HttpKernel\Kernel->boot() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:63
PHP   5. Symfony\Component\HttpKernel\Kernel->initializeContainer() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:137
PHP   6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:633
PHP   7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:753
PHP   8. Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass->process() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:141
PHP   9. Symfony\Component\HttpKernel\Kernel->setAnnotatedClassCache() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/AddAnnotatedClassesToCachePass.php:57
PHP  10. file_put_contents() /var/www/ledms/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:426

Currently, the only workaround would be to move caching outside of the nfs mount, but that seems pretty hacky and is definintely not something we're going to want to force all Vagrant/VirtualBox nfs mounted friends to do.

Are race-conditions so common that it is necessary to create exclusive locks? If so, could we check to see if an exclusive lock can be created first and based on that, add the LOCK_EX?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions