Closed
Description
Symfony version(s) affected: 5.0.x
Description
After a fresh install of symfony/skeleton
+ annotations
+ a minimal code that do a simple route, a cache:clear is required. Moreover, the cache:clear fails if we don't do a previous wget or the equivalent and then sleep a bit before clearing the cache.
How to reproduce
This occurs on Ubuntu 19.10. I put this code in .../www/bug_app_ressources/src/Controller/TestController.php
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
class TestController extends AbstractController
{
/**
* @Route("/test", name="test")
*/
public function test()
{
return new Response(
'<html><body>It\'s a test</body></html>'
);
}
}
and used this script to experiment:
cd /home/working/www
composer create-project symfony/skeleton bug_app
cd bug_app
composer require annotations
symfony server:ca:install
cp -p /home/working/www/bug_app_ressources/src/Controller/TestController.php ./src/Controller/
symfony serve -d
# Issue: The app does not work unless we do a cache:clear.
# Moreover, a wget followed by sleep is required for the cache:clear to be
# effective. Remove any of the three following commands to see that the
# app will always fail. Depending on your environment, you might need to
# increase the sleeping time to make it work.
wget https://localhost:8000/test
sleep .5
bin/console cache:clear -vvv
# After wget + sleep + cache:clear, depending on your environment, the next
# wget to work might not occur immediately.
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
sleep .05
wget https://localhost:8000/test
symfony server:stop
Additional context
It's only bugging me when I write a script to install different environments from scratch to experiment with Symfony. The work around is already in the script that is given above.