phptools-docs
phptools-docs copied to clipboard
Child processes are orphaned after stopping debug session
Hello, I have the DEVSENSE PHP Vscode extension version v1.45.15272 installed and am using the "Launch built-in server" debug configuration to debug my PHP web app in VSCode. My app requires serving some static content while the backend script is still running so that I can incrementally flush output to the browser for my users, so I need to set the PHP_CLI_SERVER_WORKERS environment variable to pre-fork additional request handlers. My launch configuration looks like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch built-in server test",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-S",
"localhost:8000",
"-t",
"."
],
"env": {
"PHP_CLI_SERVER_WORKERS": "4"
},
"port": 9003,
"serverReadyAction": {
"action": "openExternally"
}
}
}
When I start the debug session, I can see that the 4 workers are children of the main php process:
$ pstree -pa | grep dxdebug | grep php
| | | | | |-php,79708 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
| | | | | | |-php,79709 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
| | | | | | |-php,79710 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
| | | | | | |-php,79711 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
| | | | | | `-php,79712 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
I then stop the debug session. Now the 4 workers are still running, but have been orphaned. This is not the case if I manually start the server and workers from the command line or through a VSCode task:
$ pstree -pa | grep dxdebug | grep php
|-php,79709 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
|-php,79710 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
|-php,79711 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
|-php,79712 -dxdebug.client_host=127.0.0.1 -dxdebug.client_port=9003 -dxdebug.mode=develop,debug ...
This is a problem because I have to manually kill these to prevent them from taking up resources. Is this an issue with the PHP extension or a larger issue with how VSCode's debugger does process handling?
Hello,
Thank you for bringing this to our attention. I think instead of killing the process forcibly we should handle it more gently. We've made the modification and the update will be available in the next pre-release. I will ping you when the update is available.
Thanks
Thank you!
The fix is in the latest pre-release now, may I ask if it solved it for you?
Hi, I'm unfortunately having the same issue on v1.45.15341 (pre-release)
Thanks for trying, I will prepare a test environment to replicate this on our machines. Hopefully, fix it for good.
Fixed in the latest version 1.46
, please let us know if that works for you.
It appears it still doesn't work, I guess the required script files weren't included in the release package. I will take a look at it
Hi confirmed that this is still an issue on v1.46.15395
Hi, this has been fixed, it will be available in the next pre-release.
Thanks again!