Skip to content

Child processes are orphaned after stopping debug session #542

@eswolinsky3241

Description

@eswolinsky3241

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?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions