code-server icon indicating copy to clipboard operation
code-server copied to clipboard

Zombie and Lingering Process in VS Code Server on Linux servers.

Open zakkg3 opened this issue 9 months ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues there are tons but always ignored and closed: https://github.com/coder/code-server/issues/329 . :/ So i decided to start from scratch and provide all the info possible to show the problem as clearly as possible. maybe related with https://github.com/coder/code-server/issues/1795

OS/Web Information

Web Browser: Chrome / firefox does not matter. Local OS: Linux, does not matter. Remote OS: Ubuntu, CentOs Remote Architecture: amd64 code-server --version: * probably all?

Description:

The VS Code Server (Stable-138f619c86f1199955d53b4166bef66ef252935c) leaves a zombie process () and possibly contributes to other lingering processes (e.g., ssh-agent) on Ubuntu (also seen on older CentOs servers). The parent node process isn’t reaping its child, and the environment shows multiple orphaned processes, suggesting cleanup issues.

Steps to Reproduce:

Run VS Code Server on Ubuntu via SSH. Use ps aux to monitor processes after activity (e.g., editing, closing) or Possible wiht a suddenly dropped ssh connection.

Observe child processes and persistent ssh-agent instances.

Actual Behavior:

Full ps output shows a zombie and other processes:

user001  2728097       1  0 10:35 ?        00:00:00 /usr/lib/openssh/sftp-server
user002  2695434       1  0 10:04 ?        00:00:00 ssh-agent -s
user003  2360659       1  0 Feb24 ?        00:00:00 ssh-agent -s
user004  2325604       1  0 Feb24 ?        00:00:00 ssh-agent -s
user004  2325030       1  0 Feb24 ?        00:00:00 ssh-agent -s
user004  2299090       1  0 Feb24 ?        00:00:00 ssh-agent -s
user005  2268899       1  0 Feb24 ?        00:00:00 ssh-agent -s
user005  2268273       1  0 Feb24 ?        00:00:00 ssh-agent -s
userxxx  2221109       1  0 Feb24 ?        00:00:00 sh /home/userxxx/.vscode-server/cli/servers/Stable-138f619c86f1199955d53b4166bef66ef252935c/server/bin/code-server --connection-token=remo
userxxx  2221113 2221109  0 Feb24 ?        00:00:03  \_ /home/userxxx/.vscode-server/.../node ...
userxxx  2221151 2221113  0 Feb24 ?        00:00:00      \_ /home/userxxx/.vscode-server/.../node ...
userxxx  2221201 2221113  0 Feb24 ?        00:00:00      \_ [node] <defunct>
user004  2161071       1  0 Feb24 ?        00:00:00 ssh-agent -s

The parent node (PID 2221113) doesn’t reap its child (PID 2221201), leaving a zombie. Multiple ssh-agent processes (parent PID 1) also persist.

Expected Behavior:

Parent processes reap terminated children, and SSH-related processes clean up after sessions end, avoiding and orphaned entries.

Environment:

OS: Linux eu-login-01 5.15.0-131-generic #141-Ubuntu 2025 x86_64 SSH: OpenSSH_8.9p1 Ubuntu-3ubuntu0.11, OpenSSL 3.0.2 15 Mar 2022 VS Code Server: Stable-138f619c86f1199955d53b4166bef66ef252935c Setup: Cluster environment, launched via SSH

Steps to Reproduce

Expected

All processes that vs code server spawns should be cleaned if there is no active connection in some time.

Actual

process like in the list are there forever!

Logs


Screenshot/Video

No response

Does this bug reproduce in native VS Code?

Yes, this is also broken in native VS Code

Does this bug reproduce in GitHub Codespaces?

Yes, this is also broken in GitHub Codespaces

Are you accessing code-server over a secure context?

  • [ ] I am using a secure context.

Notes

No response

zakkg3 avatar Feb 25 '25 16:02 zakkg3

Does this persist indefinitely? I know VS Code keeps terminal sessions alive for a while, not sure what the timeout is though.

Also your report says this reproduces in VS Code and Codespaces, is that right? We can report it upstream if so.

code-asher avatar Mar 06 '25 21:03 code-asher

Closing for now as an upstream issue. Maybe this one? https://github.com/microsoft/vscode/issues/211462

code-asher avatar May 22 '25 20:05 code-asher