-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use localhost by default for the server log socket. #1077
Conversation
@@ -27,7 +27,7 @@ monolog: | |||
server_log: | |||
type: server_log | |||
process_psr_3_messages: false | |||
host: 0:9911 | |||
host: localhost:9911 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 0.0.0.0 work on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I guess I wasn't sure what the implication of changing it to localhost would be. I'm guessing 0 gets translated to 0.0.0.0 on 'nix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take that back. While it helps the dev environment not hang completely, windows will not write to 0.0.0.0 (rendering the server:log
command useless). On Linux does that just mean write to all interfaces/IPs on the specified TCP port in this context?
Also, whatever is decided here, the
Running it with |
…ikorra) This PR was merged into the 3.3 branch. Discussion ---------- Use 0.0.0.0 as the server log command host default. | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | - | Fixed tickets | - | License | MIT This fixes the `server:log` command on Windows when run with default settings. The current setting `0` has no meaning on Windows, and `0.0.0.0` is the standard "listen on all addresses/interfaces", so should be the most compatible. It works on both Linux and Windows for me this way. I mentioned this in another PR where the logger config has the same issue on Windows: symfony/symfony-standard#1077 Commits ------- 3fcc810 Use 0.0.0.0 as the server log host default.
I found an interesting note in the Windows Socket API error codes that even explicitly states that address 0 is not valid for an address to connect/send to: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668.aspx#WSAEADDRNOTAVAIL Though if you ping 0 from the command line it returns 0.0.0.0. I guess since |
I think this PR has been automatically closed because I've just removed the master branch. Can you reopen it on 3.3 instead? Thanks. |
This PR was merged into the 3.3 branch. Discussion ---------- Use localhost for the server log handler. See: #1077. Had to create this new PR to target 3.3 specifically. This is to set the server log handler hostname to something that's resolvable under both Linux and Windows. I'm not sure if this should stick to localhost or 127.0.0.1 (which is used elsewhere, such as the defaults in the parameters file). Being set to 0 on Windows causes a DNS timeout in `stream_socket_client` which there doesn't seem to be any control over. Commits ------- 8c680c7 Use localhost for the server log handler.
This fixes the server log on Windows, which is currently causing the dev environment to hang and become unusable:
symfony/symfony#22712
The hostname "0" apparently doesn't work on Windows, but it does on Linux. Though I've honestly never seen "0" used in a connection string before. I figure localhost is the best default route to go. There is still the issue of the ServerLogHandler in the monolog bridge bundle where the underlying issue surfaced.
Basically since "0:9911" was not valid on Windows, the socket was never opened. Yet every time it would attempt to log to the socket again it would go through the same timeout period. Multiply that by all the times that gets called and you'll be waiting a while to get a response...
Even though this change makes the dev environment usable on Windows, the Server Log handler still has a huge performance impact there. It takes almost 6-8x longer for a page to load in the dev environment now.