Contactez-nous

Kitpages
17 rue de la Frise
38000 Grenoble
tel : 04 58 00 33 81

Par Philippe Le Van Dernière mise à jour : 13 April 2011

Symfony2, sqlite3 et samba

Introduction

Sqlite3 et samba ne font pas bon ménage. On a en permanence des problèmes de lock sur la base Sqlite.

Le profiler de Symfony2 utilise sqlite3 et donc si votre code est sur un partage samba, vous avez des erreurs du type :

Warning: SQLite3::exec(): database is locked in /web/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php on line 40

Call Stack:
    0.0002     322016   1. {main}() /web/web/app_dev.php:0
    0.0084     479392   2. Symfony\Component\HttpKernel\Kernel->handle() /web/web/app_dev.php:20
    0.2919    1067868   3. Symfony\Bundle\FrameworkBundle\HttpKernel->handle() /web/app/bootstrap.php.cache:586
    0.2920    1068256   4. Symfony\Component\HttpKernel\HttpKernel->handle() /web/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php:35
    0.2920    1068256   5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /web/app/bootstrap.php.cache:403
    0.8349    2069060   6. Symfony\Component\HttpKernel\HttpKernel->filterResponse() /web/app/bootstrap.php.cache:440
    0.8350    2069764   7. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->dispatch() /web/app/bootstrap.php.cache:445
    0.8393    2076852   8. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /web/app/cache/dev/classes-cdc01.php:1772
    0.8402    2081028   9. Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher->triggerListener() /web/app/cache/dev/classes-cdc01.php:1152
    0.8402    2081028  10. Symfony\Component\EventDispatcher\EventDispatcher->triggerListener() /web/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:49
    0.8402    2081028  11. Symfony\Bundle\FrameworkBundle\Profiler\ProfilerListener->onCoreResponse() /web/app/cache/dev/classes-cdc01.php:1220
    0.8403    2081056  12. Symfony\Component\HttpKernel\Profiler\Profiler->collect() /web/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Profiler/ProfilerListener.php:98
    0.8434    2109764  13. Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage->write() /web/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php:299
    0.8434    2109764  14. Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage->initDb() /web/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php:96
    0.8450    2110240  15. SQLite3->exec() /web/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php:40

Solution

Le problème n'est pas vraiment soluble. On peut juste le contourner en mettant les fichiers de cache ailleurs que sur le partage samba.

Pour cela il faut éditer le fichier app/config/config.yml et ajouter un paramètre cache_dir.

On peut par exemple mettre la conf suivante :

parameters:
    kernel.cache_dir: '/tmp/sf-test'

Commentaires

Ajouter un commentaire