vscode-terosHDL icon indicating copy to clipboard operation
vscode-terosHDL copied to clipboard

Language server auto kill process when using ssh

Open gmartina opened this issue 2 months ago • 3 comments

fixes #726 fixes #817

Summary

  • Added two new settings: teroshdl.cleanup.killServerProcesses.enabled (default false) and teroshdl.cleanup.killServerProcesses.gracePeriodMs (ms).

  • Implemented safe cleanup in rust_hdl.ts and verible.ts: pgrep -f via execFile, PID validation, send SIGTERM then SIGKILL after the grace period.

  • Cleanup runs only when enabled and the session is Remote‑SSH (vscode.env.remoteName check).

  • Added a Web UI indicator + commands (teroshdl.cleanup.openSettings)

Why I implemented the config option in VS Code settings:

VS Code settings give per-scope granularity: User (global), Workspace (project), and Remote (per-SSH-host).

Tests

I could not debug Teros extension when using it over SSH. So I had to build a release and test it.

Disabled

image
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       3218  2.2  0.1  13352  7428 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3360  4.5  2.1 100240 86308 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3401  0.0  0.0   6604  2252 pts/0    S+   12:55   0:00 grep vhdl_ls
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       3218  2.1  0.1  13352  7428 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3360  4.1  2.1 100240 86308 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3403  0.0  0.0   6604  2188 pts/0    S+   12:55   0:00 grep vhdl_ls
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       3218  0.7  0.1  13352  7428 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3360  0.5  0.1  13416  7524 ?        Ssl  12:54   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3464  0.8  2.1 100296 86380 ?        Ssl  12:55   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3713  3.0  0.1  13400  7480 ?        Ssl  12:56   0:00 /home/admin/.vscode-server/extensions/teros-technology.teroshdl-8.0.10/server/vhdl_ls/0.84.0/vhdl_ls-x86_64-unknown-linux-musl/bin/vhdl_ls --silent
admin       3756  0.0  0.0   6604  2192 pts/0    S+   12:56   0:00 grep vhdl_ls

Enabled

image image
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       4710  0.0  0.0   6604  2272 pts/0    S+   13:01   0:00 grep vhdl_ls
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       4713  0.0  0.0   6604  2244 pts/0    S+   13:01   0:00 grep vhdl_ls
admin@debian-server:~$ ps aux | grep verible
admin       4715  0.0  0.0   6604  2104 pts/0    S+   13:01   0:00 grep verible
admin@debian-server:~$ ps aux | grep vhdl_ls
admin       4717  0.0  0.0   6604  2232 pts/0    S+   13:01   0:00 grep vhdl_ls
admin@debian-server:~$ 

gmartina avatar Nov 09 '25 18:11 gmartina

Please check the conflicts.

qarlosalberto avatar Dec 10 '25 10:12 qarlosalberto

@qarlosalberto How can I add this through auto_package?

        "configuration": {
            "type": "object",
            "title": "TerosHDL",
            "properties": {
                "teroshdl.cleanup.killServerProcesses.enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "Enable automatic cleanup of language server processes on extension exit/deactivate (disabled by default)."
                },
                "teroshdl.cleanup.killServerProcesses.gracePeriodMs": {
                    "type": "number",
                    "default": 500,
                    "minimum": 0,
                    "description": "Grace period in milliseconds between SIGTERM and SIGKILL when killing language server processes."
                }
            }
        }

gmartina avatar Dec 14 '25 19:12 gmartina

Try directly here: https://github.com/TerosTechnology/vscode-terosHDL/blob/dev/auto_package/templates/package.nj

Or create a new .nj and include it there.

El dom, 14 dic 2025, 20:03, G. Martin @.***> escribió:

gmartina left a comment (TerosTechnology/vscode-terosHDL#833) https://github.com/TerosTechnology/vscode-terosHDL/pull/833#issuecomment-3651822426

@qarlosalberto https://github.com/qarlosalberto How can I add this through auto_package?

    "configuration": {
        "type": "object",
        "title": "TerosHDL",
        "properties": {
            "teroshdl.cleanup.killServerProcesses.enabled": {
                "type": "boolean",
                "default": false,
                "description": "Enable automatic cleanup of language server processes on extension exit/deactivate (disabled by default)."
            },
            "teroshdl.cleanup.killServerProcesses.gracePeriodMs": {
                "type": "number",
                "default": 500,
                "minimum": 0,
                "description": "Grace period in milliseconds between SIGTERM and SIGKILL when killing language server processes."
            }
        }
    }

— Reply to this email directly, view it on GitHub https://github.com/TerosTechnology/vscode-terosHDL/pull/833#issuecomment-3651822426, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNN4R2OWW3ZGK2QHBCIJTD4BWX67AVCNFSM6AAAAACLS5ZRIKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNJRHAZDENBSGY . You are receiving this because you were mentioned.Message ID: @.***>

qarlosalberto avatar Dec 14 '25 19:12 qarlosalberto