microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

systemd-shutdown[1]: Waiting for process: cpptools, cpptools-srv, node

swarren opened this issue · comments

Environment

  • OS and Version: Ubuntu 22.04
  • VS Code Version:
  • C/C++ Extension Version:
  • If using SSH remote, specify OS of remote machine: Both vscode GUI and backend are running on Ubuntu 22.04 (separate machines)

Bug Summary and Steps to Reproduce

Bug Summary:
vscode/cpptools delays system shutdown for minutes.

Steps to reproduce:

  1. Connect to system using remote explorer.
  2. Use vscode for a while.
  3. Close vscode window (disconnects from machine in question)
  4. SSH back to the machine outside vscode
  5. Run poweroff
  6. Using a BMC/KVM, watch the shutdown process on the console. See sytemd-shutdown delaying shutdown for a few minutes because cpptools, cpptools-srv, node processes are still running.

Expected behavior:
At step 5, the system powers off almost immediately.

Configuration and Logs

NA; will add any logs later, after the machine has rebooted.

Other Extensions

Many.

Additional context

No response

Normally, cpptools is supposed to shutdown when the connection to VS Code ends, but and it also has a timeout that should self-terminate the process after 4 minutes. But your OS and tools like kill should be able to terminate the cpptools and cpptool-srv processes. I'm not sure what else more we could do, i.e. what did you want us to change? Can you run a command that kills all cpptools and cpptools-srv processes, e.g pkill cpptools?

I guess the issue is that when it's killed, sometimes it doesn't exit, and always it just respawns a new process. I closed vscode, then logged in using ssh in a terminal and couldn't get rid of cpptools:

swarren@machinename:~$ ps auxww|grep cpp
swarren     2855  3.0  0.4 597280 536000 ?       Sl   13:17   2:12 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    15801  0.0  0.5 4305140 667508 ?      Sl   13:28   0:01 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 2855 {6F8242E4-7297-4CB9-8177-AD5AC3795EAA}
swarren    15869  0.0  0.5 4313500 725156 ?      Sl   13:28   0:01 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 2855 {B1750B7C-BDA4-4FEB-8423-38F4491CD7A1}
swarren    15973  0.2  0.5 4335020 742460 ?      Sl   13:28   0:10 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 2855 {37ED71D9-5E46-416A-B263-34A5F81430CB}
swarren    16023  0.0  0.3 4296368 471864 ?      Sl   13:28   0:00 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 2855 {F58067BB-4330-4CC0-BCFA-5B24E63EAB99}
swarren    18866  0.3  0.5 4331372 691056 ?      Sl   14:09   0:04 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 2855 {68A095C9-CDC0-4260-BEB1-8327434A3714}
swarren    19121  0.0  0.0   6612  2276 pts/0    S+   14:29   0:00 grep --color=auto cpp
swarren@machinename:~$ pkill cpptools
swarren@machinename:~$ ps auxww|grep cpp
swarren    19124  263  0.0 114376 85016 ?        Sl   14:30   0:02 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19156  0.0  0.0   6480  2352 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ ps auxww|grep cpp
swarren    19124  226  0.2 364188 334844 ?       Sl   14:30   0:09 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19159  0.0  0.0   6480  2280 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ pkill cpptools
swarren@machinename:~$ ps auxww|grep cpp
swarren    19124  115  0.2 346052 333836 ?       Sl   14:30   0:12 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19161 76.7  0.4 610872 561036 ?       Dl   14:30   0:03 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 19124 {FCA2F388-9DBA-4C6B-B3B7-D09A30BE74AE}
swarren    19190  7.0  0.0  42888 29004 ?        S    14:30   0:00 /usr/bin/python3 /usr/share/apport/apport -p19161 -s11 -c0 -d1 -P19161 -u5070 -g30 -- !swarren-data!home-.vscode-server!extensions!ms-vscode.cpptools-1.19.9-linux-x64!bin!cpptools-srv
swarren    19192  0.0  0.0   6480  2256 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ 
swarren@machinename:~$ 
swarren@machinename:~$ 
swarren@machinename:~$ ps auxww|grep cpp
swarren    19124 90.8  0.2 346052 333836 ?       Sl   14:30   0:12 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19161 43.8  0.4 610872 561036 ?       Dl   14:30   0:03 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 19124 {FCA2F388-9DBA-4C6B-B3B7-D09A30BE74AE}
swarren    19190  1.7  0.0  42888 29004 ?        S    14:30   0:00 /usr/bin/python3 /usr/share/apport/apport -p19161 -s11 -c0 -d1 -P19161 -u5070 -g30 -- !swarren-data!home-.vscode-server!extensions!ms-vscode.cpptools-1.19.9-linux-x64!bin!cpptools-srv
swarren    19194  0.0  0.0   6480  2252 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ kill 19124 19161
-bash: kill: (19124) - No such process
-bash: kill: (19161) - No such process
swarren@machinename:~$ ps auxww|grep cpp
swarren    19197  303  0.0  68440 39208 ?        Sl   14:30   0:03 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19228  0.0  0.0   6480  2424 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ ps auxww|grep cpp
swarren    19197  127  0.0 105416 75964 ?        Sl   14:30   0:10 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19230  0.0  0.0   6480  2244 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ ps auxww|grep cpp
swarren    19197  116  0.0 113136 83584 ?        Sl   14:30   0:11 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19232  0.0  0.0   6480  2224 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ kill 19197
swarren@machinename:~$ ps auxww|grep cpp
swarren    19197  101  0.0 107932 94700 ?        Sl   14:30   0:16 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19235  0.0  0.0   6480  2260 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ kill 19197
swarren@machinename:~$ ps auxww|grep cpp
swarren    19237  219  0.0  61596 32408 ?        Sl   14:30   0:02 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19268  0.0  0.0   6480  2244 pts/0    S+   14:30   0:00 grep --color=auto cpp
swarren@machinename:~$ ps auxww|grep cpp
swarren    19237  100  0.1 198932 136992 ?       Sl   14:30   0:44 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19323 87.6  0.3 4312072 482416 ?      Sl   14:31   0:02 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools-srv 19237 {32E8EF7E-1A4F-4E55-991B-2BE833846EF3}
swarren    19353  0.0  0.0   6480  2428 pts/0    S+   14:31   0:00 grep --color=auto cpp
swarren@machinename:~$ kill 19237 19323
swarren@machinename:~$ ps auxww|grep cpp
swarren    19237 98.1  0.1 173860 161784 ?       Sl   14:30   0:53 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19364  0.0  0.0   6480  2256 pts/0    S+   14:31   0:00 grep --color=auto cpp
swarren@machinename:~$ kill 19237 19323
-bash: kill: (19323) - No such process
swarren@machinename:~$ ps auxww|grep cpp
swarren    19366  183  0.0  59192 30128 ?        Sl   14:31   0:01 /home/swarren/.vscode-server/extensions/ms-vscode.cpptools-1.19.9-linux-x64/bin/cpptools
swarren    19397  0.0  0.0   6480  2364 pts/0    S+   14:31   0:00 grep --color=auto cpp

Hi @swarren . Given that node is also preventing shutdown, this would seem to be a VS Code issue. It hosts node to run the extension. If VS Code itself is lingering and not shutting down node, then our TypeScript component would not shut down, and the native processes still running would seem to be due to still being associated with a live connection to our TypeScript component.