2

I found out that I have quite many Symfony local web server workers registered (around ~35), and the number keeps growing. I usually just start server with symfony serve and then kill it (Ctrl + \) when no longer needed. Apparently killing it leaves a worker behind, as seen in symfony server:status. Running symfony serve again just creates a new worker.

symfony server:status output:

Local Web Server
    Not Running

Workers
    PID 6327: /usr/bin/php7.2 -S 127.0.0.1:43653 -d variables_order=EGPCS /home/mindaugas/.symfony/php/83247c3521c3ac3990bf3f823ef473db0a9445e1-router.php
    PID 24596: /usr/bin/php7.2 -S 127.0.0.1:37789 -d variables_order=EGPCS /home/mindaugas/.symfony/php/83247c3521c3ac3990bf3f823ef473db0a9445e1-router.php
    PID 6575: /usr/bin/php7.4 -S 127.0.0.1:42505 -d variables_order=EGPCS /home/mindaugas/.symfony/php/83247c3521c3ac3990bf3f823ef473db0a9445e1-router.php
    PID 41550: /usr/bin/php7.4 -S 127.0.0.1:36313 -d variables_order=EGPCS /home/mindaugas/.symfony/php/83247c3521c3ac3990bf3f823ef473db0a9445e1-router.php
    ...

Environment Variables
    None

So my questions regarding this:
#1: is it possible to quickly kill the server? I assume symfony server:stop is more correct way, but that requires additional console window and entering the command.
#2: how to kill those workers that are registered from previous sessions? Trying e.g. kill 6327 says that there's no such process. Also they're not gone after system restart.

Those extra workers are bothering me because for each one of them the server log output in the console is duplicated. So right now on each request to the server I get around 3k lines of log output in the console. Which makes it pretty useless.

mindaugasw
  • 1,116
  • 13
  • 18
  • While not really solving the issue, for a quick workaround I created an alias for the following command: `rm -r ~/.symfony/var/* 2> /dev/null & symfony server:start` It removes all workers each time and only then starts the server. – mindaugasw Dec 20 '20 at 23:21

3 Answers3

4

I have the same problem after upgrading to Symfony CLI version v4.19.0...

My (very) bad workaround:

rm /home/myusername/.symfony/var/83247c3521c3ac3990bf3f823ef473db0a9445e1/*
S. Dre
  • 647
  • 1
  • 4
  • 18
CrSrr
  • 56
  • 1
  • Thank you, I have just tried it and it works. Obviously a very temporary solution, but at least it's something. – mindaugasw Oct 08 '20 at 21:07
0

Edit: this answer is not accurate, as hinted a by @CrSrr's answer above.

The symfony command adds data to both the ./log and ./var directories. Deleting entries in only one of those does not remove the appearance of non-existent workers in the project directory. I was fooled by checking status in a directory where the server:start had never been run.

A bug report is on file with symfony here.

Just faced with a similar issue. The PIDs were not to be found.

PS G:\workspace\joined> symfony server:status
Local Web Server
    Not Running

Workers
    PID 7732: C:\php\php-cgi.exe -b 63801 -d error_log=C:\Users\George\.symfony\log\e79ad2f4b30a2f0a35c3b5ab08772770b382a3d6.log
    PID 19324: C:\php\php-cgi.exe -b 62927 -d error_log=C:\Users\George\.symfony\log\e79ad2f4b30a2f0a35c3b5ab08772770b382a3d6.log
    PID 17968: C:\php\php-cgi.exe -b 50197 -d error_log=C:\Users\George\.symfony\log\e79ad2f4b30a2f0a35c3b5ab08772770b382a3d6.log
    PID 14040: C:\php\php-cgi.exe -b 55075 -d error_log=C:\Users\George\.symfony\log\e79ad2f4b30a2f0a35c3b5ab08772770b382a3d6.log

Environment Variables
    None

In the Windows OS, the log files are kept in %USERPROFILE%.symfony. There's most likely a similar location in your home directory. Deleting all the contents of that directory allowed a new Windows Terminal app to show:

PS G:\workspace> symfony server:status
Local Web Server
    Not Running

Workers
    No Workers

Environment Variables
    None
geoB
  • 4,578
  • 5
  • 37
  • 70
0

do symfony serve:stopto stopped the server and do against symfony serve to run the server good luck

TAH
  • 29
  • 4
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 22 '22 at 15:13