-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Performance Related Issues in 3.3 on Windows #22712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do you have any other error handlers besides the one provided by Symfony? |
Well, the output does not look broken. The server is properly running. But it looks like you send logs to the console, and these logs include the logging of silenced warnings too (but a silenced warning here is normal. The command tries to connect to the port to know whether it is already used or no. So failing to connect is expected) |
I don't have any other error handlers configured. This is straight from creating a new project via composer, then starting up the built-in web server with the @stof is correct. It seems like the server runs, but it times out without ever displaying anything trying to hit the default homepage. I'm testing a bit more today from a different workstation. But I ran the same commands/steps on an Ubuntu box and it worked without issue. |
I tested from a completely separate Windows 10 machine. The issue still happens. It works fine with 3.2, but not with 3.3. This is all I do to test at the moment: composer.bat create-project symfony/framework-standard-edition web_server_test "3.3.*" -s dev
cd web_server_test/
php bin/console server:run Those same steps worked fine from my Ubuntu machine. |
After some testing I've realized that the issue is performance related on Windows (On Windows 10 v1607 anyway). It takes way longer for the kernel to handle the request in 3.3 than it did in 3.2. It just hangs then timesout. I was able to get the page to display once after several dozen attempts after I was messing with different things, but even then it took extremely long for the demo page to come up. |
The issue seems to be related to the monlog handler that was added here: symfony/symfony-standard@53396e4#diff-9d592f57989b96cb71c5cc53d2c0e92d If I comment out the following in config_dev.yml the speed goes back to normal: server_log:
type: server_log
process_psr_3_messages: false
host: 0:9911 ping @lyrixx |
Could you tried to make a blackfire profile of this? I don't have windows :/ |
Currently attempting to...can't seem to get the profiling data to show up on the blackfire site :/ Have double-checked my config and everything looks fine. I was able to generate a debug using xdebug which is how I narrowed it down to a monolog handler. |
The process component is not used in that part of the code. It looks strange to me. |
Yeah, that may have been my mistake 😅 hah. I think I was looking at the wrong cachegrind file for a bit. Still need to finish my morning coffee. Doesn't help that I'm trying to trace a process within a process, which would also explain why I'm not getting blackfire results. The builtin webserver process is kicked off via the process component which is where the slow-down is happening. Would have to play with the arguments to get blackfire to work there I guess? |
You can just profile a page directly from your browser. it will be much simpler ;) |
I narrowed down the issue and created a PR in symfony-standard, explaining the issue there. Ultimately I think the monolog ServerLogHandler needs to throw an exception if it can't create the socket initially, or just not try thereafter ( |
I can confirm the problem. On a fresh windows server install. If I comment the same lines in config_dev.yml, the page loads without problems. |
Hi. Can you confirm that the 2 PR fix the issue ?
Thanks |
It works with 0.0.0.0 and with 127.0.0.1 but it's still very very slow, 8 seconds to show the page compared to 200ms when commenting the lines. |
@netsuo please provide us a Blackfire profile to help debug the performance issue then, it will make things much easier. |
It was my first time using blackfire so i'm sorry if I didn't use it correctly, but anyway here's the profile on a fresh install of php 7.1 thread safe on Win 10, using server:run with 0.0.0.0 as address in config_dev.yml. https://blackfire.io/profiles/5fb40f05-4d50-4afb-97d8-773aae9d5293/graph |
@netsuo Thanks a lot. So it looks like the issue comes from https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php#L58 I occurs when it's not possible write to the socket. So I guess the socket could not be opened. @nicolas-grekas Do you have a hint here ? @netsuo Could you juste comment this line https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php#L48 so see what is the real error ? Thanks. |
The problem as I understand it is two-fold on Windows (in regards to the different slow-down times). By leaving the host at the name I think the following for
Edit: I was mistaken. The timeout is related to writing to the socket (as described by @netsuo below). There is no timeout opening the socket because of the |
@lyrixx Notice: fwrite(): send of 2425 bytes failed with errno=10057 A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. |
But IIRC, it could not work on windows? It can work if and only if the server is already listening? |
I think the trick here is to use:
...instead of |
I opened the above PR that resolves this. Seems like to avoid the hanging the way to go is the |
…ng on Windows (ChadSikorra) This PR was squashed before being merged into the 3.3 branch (closes #22787). Discussion ---------- [MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | - | Fixed tickets | #22712 | License | MIT This resolves the issue discussed in #22712. This works on both Windows and Linux. Specifically it removes the additional hanging that was caused on Windows when attempting to write/close a TCP socket that's not open on the other end in asynchronous mode. Commits ------- be60aa4 [MonologBridge] Fix the Monlog ServerLogHandler from Hanging on Windows
Just a FYI that this isn't completely resolved until config_dev.yml is modified in symfony-standard: It will still hang (1-2 seconds each time) trying to resolve |
Uh oh!
There was an error while loading. Please reload this page.
The built-in web server run command does not seem to work for me on Windows. At first I thought it might have something to do with my setup, but I'm starting to doubt that. It works fine from the same Windows box with Symfony 3.2 using the same version of PHP (7.1 -- though I have tried others and get the same problem).
Edit: After more testing the issue seems to be performance related on Windows.
The text was updated successfully, but these errors were encountered: