| Q | A
| ---------------- | -----
| Bug report? | yes
| Feature request? | no
| BC Break report? | no
| RFC? | no
| Symfony version | 3.3.2
Hello,
Since I can use the bash ubuntu on windows, I have been using it instead of a vm. Few months ago I started a tiny sf project, sf 3.2, no problem at all (same for 3.1), everything worked fine.
But today, I created a new symfony 3.3 project, and it was unsuable, the page took 30 sec to load (after I put app_dev.php). I even re-installed my bash, clean install, still the same (but no problem with symfony 3.2). I tried on my vm, it was all good, so the problem is only on the ubuntu bash for windows :(
app_dev.php is the front controller for web requests. What does bash have to do with it ?
@Arvi89 I have no idea what your actual issue is, but it is worth pointing out that WSL (Windows Subsystem for Linux) is beta software. Use Docker, or better yet, install Ubuntu for real (and then use LXC). ;-)
@stof Nothing, but I installed my sf project on Ubuntu Windows (also called bash on Ubuntu on Windows).
@robfrawley Yeah I know, it's just weird how it suddenly doesn't work anymore (it does, but way too slow, and no error anywhere). Usually, I use Ubuntu for dev, but on my surface, I'll keep Windows ^^
Maybe it's related to #23213? @iltar said that it took a long to load the page ... and then it took a long again to reload the page because the container was being recompiled continuously due to a bug.
Could be related to file IO. I'm running WSL as well for some fiddling at home, but I haven't been using 3.3 on here yet. I do know, that file IO is extremely slow on WSL.
@javiereguiluz the reason it took long for me, was a container recompilation every request. However, this was roughly 7~10 seconds for a project with ~100 pages and 30 bundles or so.
@Arvi89 can you please update to Symfony 3.3.4 (https://symfony.com/blog/symfony-3-3-4-released) and see if this has been fixed? Thanks!
@javiereguiluz Same problem. I actually re-installed my surface completely (for other reasons ^^), and I still have issues with 3.3.4
I tried with 3.2.11 and this was still fine.
It's just a clean install, symfony new test, in the home folder.
Screenshot of the profiler: http://imgur.com/a/Cqsjr
I've got the same problem with a fresh installation of WSL and symfony 3.3.4.
Also on the first page hit after starting the server I noticed that the debug bar on the bottom of the screen is missing and there is an error in the console:
PHP 7.0.18-0ubuntu0.16.04.1 Development Server started at Wed Jul 12 01:01:13 2017
Listening on http://127.0.0.1:8000
Document root is /mnt/c/Repos/festivalcms/web
Press Ctrl-C to quit.
[Wed Jul 12 01:01:54 2017] 127.0.0.1:51728 [200]: /
[Wed Jul 12 01:01:54 2017] 127.0.0.1:51729 Invalid request (Unexpected EOF)
[Wed Jul 12 01:02:23 2017] 127.0.0.1:51761 [200]: /_wdt/341554
[Wed Jul 12 01:02:54 2017] 127.0.0.1:51772 [200]: /
[Wed Jul 12 01:03:50 2017] 127.0.0.1:51807 [200]: /_profiler/341554?panel=time
[Wed Jul 12 01:04:20 2017] 127.0.0.1:51829 [200]: /_wdt/c1cdf1
[Wed Jul 12 01:08:03 2017] 127.0.0.1:51970 [200]: /
Second page hit is without error and the debug bar is shown.
Screenshot of first hit with DevTools open
Screenshot of the profiler
Edit:
If I use an apache2 for serving the application it is just as slow as the php server as long as I use the dev environment.
As soon as I use prod it is as quick as it should be.
Can you try the 3.4 branch? It contains some perf fixes that will be part of 3.3.5
More specifically, #23465 may solve this issue.
I installed the latest version via composer but it seems like it didn't help.
I get an Exception on page load ( Screenshot ):
Symfony\Component\Debug\Exception\UndefinedMethodException:
Attempted to call an undefined method named "getParameter" of class "AppBundle\Controller\DefaultController".
at src/AppBundle/Controller/DefaultController.php:18
at AppBundle\Controller\DefaultController->indexAction(object(Request))
at call_user_func_array(array(object(DefaultController), 'indexAction'), array(object(Request)))
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:153)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:171)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/app_dev.php:29)
at require('/mnt/c/Repos/test34/web/app_dev.php')
(vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)
My main problem with this is that it needs 54 secs until the error page is shown.
I tested Symfony 3.3.4 under WSL with standard bash/zsh and mintty. all green, it works great ✅
⚠️ But I notice that the default page is extremely slow.
Same in 3.3.3
Exactly same issue for me...3.3.5. 17s for generate the basic page after fresh install. I7 mobile kaby lake,16GO RAM, 512 SSD
No problem with previous symfony version 2.8.
Could any of you provide a Blackfire profile?
Hi nicolas. i do not have a blackfire account. I try to install it but it ask to me a client-id.
There are some instructions on the doc of blackfire.io about the installation process. You need to create an account of course, that's how you'll get all credentials. Please use the feedback form if you need more help.
You can log in using GitHub/Google/Etc, and then just follow the instructions as outlined here: https://blackfire.io/docs/up-and-running/installation
Ok i dit a test. I can see result on a URL.
https://blackfire.io/profiles/2bf8da87-159f-4435-8d1b-b6176878f03c/graph
Can you see it wihtout my loggin?
I can, here is the relevant excerpt, ping @lyrixx ;)
Ok :)
the same under symfony 2.8. Test is incredibily faster just a few seconds.
https://blackfire.io/profiles/87653215-9b72-4bf9-a07b-11994a85e39f/graph
fresh install too.
Can you comment the serve_log section in your config_dev file? same as these:
https://github.com/symfony/symfony-standard/blob/6a101cf26395d67ee5f2f8d71929560d6c29f803/app/config/config_dev.yml#L27-L30
before disabling and if you have host: localhost:9911
there, can you replace it by host: 127.0.0.1:9911
?
better?
ok, but I have to go I will try on my return as soon as possible.
i did the test on 127.0.0.1:80 not on localhost.
sudo blackfire curl http://127.0.0.1/test_project/web/app_dev.php
I mean on that config line in config_dev.yml, not the ip of the curl call :)
No, @nicolas-grekas isn't talking about the URL you used to create the Blackfire profile; he's talking about editing your app/config/config_dev.yml
config file and amending the server_log
option and trying the following steps to see if either resolves your issue:
server_log.host
set to localhost:9911
in your config, try setting it to 127.0.0.1:9911
.server_log
section to disable that handler completely.See https://github.com/symfony/symfony/issues/22712#issuecomment-302132509 and https://github.com/symfony/symfony-standard/pull/1077 for additional information about similar issues that have come up. Hopefully it's the same problem you are running into, as the fix is straightforward.
Sorry for the curl call. :)))
ITs a fresh install which has just a few hour, the config_dev.yml file is already configured like that :
server_log:
type: server_log
process_psr_3_messages: false
host: 127.0.0.1:9911
Ok i will try to comment the log section .Thank you
@nicolas-grekas Thank you for your answer i read the post link you give it to me. But i dont think its the same problem. These post refer for installations under window. I do not have any problem with xamp for example, Symfony default 3.3.5 page is generated in less than 200ms with xamp on my computer. In my case its only under ubuntu with windows substystem for linux, and i dont have this probleme with old and very fat symfony 2.8 project. The loading time is quite satisfactory for a development environment. But with symfony 3.3.5 its near than 20 secondes for loading a page. Its unusable.
As you can see, works like a charm under xamp
@Madden33 could you comment this block, refresh twice the page, and tell us how many time it took to be generated ?
@lyrixx 51ms... no problem anymore with win sub syst for linux, if i comment this block. :)
Maybe a php extension is missing on my installation to improve log performance?
This is the list of my loaded php extenstions :
[PHP Modules]
blackfire
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
blackfire
I don't know what is wrong here. Maybe there is a kind of firewall ?
Does it occurs on all ubuntu bash on windows ?
@lyrixx I have a fresh install on a unbuntu bash for windows too and had the same problem with 3.3.x, i had to rollback to 3.2 to have a decent loading time
Thanks for your feedback.
To all people landing here because Symfony 3.3 is slow on ubuntu bash for windows:
You can simply disable the Monolog handler by commenting this code block in your application.
there are no need to downgrade to symfony 3.2 ;)
I installed a fresh version of symfony 3.3 and i also have the same exact problem. To fix this i had to do one of the following thing :
From that it appears that detecting a "Connexion refused" is very slow on ubuntu bash (so it's more a bug on this, or maybe PHP ?)
I made a simple test :
It show that it takes around 1sec to detect a Connexion Refused, and since the connection will have a false value it will retry to connect at the next log, so 24 calls to the logs will end up in a 24 sec of lag if there is no server.
Would be a good thing to not retry connexion to the log server if not available after the first try ?.
I guess that's a bug in WSL? Can you try if any combinasion of STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_PERSISTENT remove that 1s timeout?
It was already those flags :
STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_PERSISTENT = 7
And also try to remove some of the flags, same bugs happens
@lyrixx Thank you, that helped.
BTW, why does monolog impact performance so drastically?
Because monolog try to connect to a server. And this server does not exist. PHP should timeout, but I don't know why, on ubuntu bash it does not work like it should be.
I guess our best way here, it's to disable this feature on ubuntu bash as it does not work.
What do you think @nicolas-grekas ?
Or to not configure a server that should timeout by default? x) (why was it done like that??)
Sorry, I did not understand. What do you mean ?
You said that monolog tries to connect to a server that doesn't exist (because of configuration, right?). Why is it the case by default? Why not avoid that fact and let the user enable it?
@Nek- Either it should be disabled by default or it should be present in the documentation. But I guess a doc line is better than disabling this feature.
Where's the point in shipping a default configuration that does not work properly? If having a server available under that IP and port configuration is mandatory, this should be stated anywhere. If this server is purely optional (which makes more sense for me), this configuration should be commented out to give an example, but not slow down the default configuration
You said that monolog tries to connect to a server that doesn't exist (because of configuration, right?). Why is it the case by default? Why not avoid that fact and let the user enable it?
Because you can not know if the server is enable before trying to connect it.
Where's the point in shipping a default configuration that does not work properly
@NicoHaase There are none. That's exactly the point. That's why I would like to remove this feature on Ubuntu Bash.
How would setting up the monolog server look like to work properly with symfony on windows subsystem? Might be worth mentioning!
I'm closing here because it's been 8 months since the last comment and also because Symfony 3.3 is no longer maintained. If the error persists with a maintained version (2.8, 3.4, 4.0, 4.1 or masteR) please open a issue with the new details. Thanks!
Most helpful comment
Thanks for your feedback.
To all people landing here because Symfony 3.3 is slow on ubuntu bash for windows:
You can simply disable the Monolog handler by commenting this code block in your application.
there are no need to downgrade to symfony 3.2 ;)