Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Killing tasks does not actually kill them #242891

Open
johuhype opened this issue Mar 7, 2025 · 15 comments · Fixed by #243267
Open

Killing tasks does not actually kill them #242891

johuhype opened this issue Mar 7, 2025 · 15 comments · Fixed by #243267
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug regression Something that used to work is now broken terminal-conpty Integrated terminal issues related to the ConPTY backend under-discussion Issue is under discussion for relevance, priority, approach windows VS Code on Windows issues
Milestone

Comments

@johuhype
Copy link

johuhype commented Mar 7, 2025

Type: Bug

When I kill a task in the terminal tab, it gets removed from the lists of running tasks, however starting in one of the recent code versions (probably 1.98.0?), the task does not get killed and is still runing in the background and can also still be found in the windows task manager.

Example: vite dev/hot server. Everytime I kill a server task, it keeps on running. The next time I start it, the used port number will increase due to the previous one still being in use.

VS Code version: Code 1.98.0 (6609ac3, 2025-03-04T21:06:18.612Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 47.81GB (33.72GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (14)
Extension Author (truncated) Version
project-manager ale 12.8.0
npm-scripts-advanced dae 0.0.8
vscode-eslint dba 3.0.10
githistory don 0.6.20
gitlens eam 16.3.2
EditorConfig Edi 0.17.1
prettier-vscode esb 11.0.0
i18n-ally lok 2.13.1
materialdesignicons-intellisense luk 4.1.0
git-graph mhu 1.30.0
atom-keybindings ms- 3.3.0
errorlens use 3.24.0
volar Vue 2.2.8
material-theme zhu 3.19.0
@Sup2point0
Copy link

Sup2point0 commented Mar 8, 2025

Facing this issue too =(

I can get around it with Ctrl+C in the terminal, but if I forget then the port's left hanging and I'll have to pull out netstat and taskkill...

Edit: Found a faster way to close hanging ports, just run npx kill-port <PORT>. If you have multiple hanging, you can use a wildcard like npx kill-port 808*

@meganrogge
Copy link
Contributor

@deepak1556 or @Tyriar nothing has changed with tasks in recent iterations that could explain this. Are you aware of any node pty changes or other that could?

@deepak1556
Copy link
Collaborator

Yeah very likely related to #242942 (comment), will check.

@deepak1556 deepak1556 self-assigned this Mar 10, 2025
@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug windows VS Code on Windows issues regression Something that used to work is now broken terminal-conpty Integrated terminal issues related to the ConPTY backend under-discussion Issue is under discussion for relevance, priority, approach labels Mar 10, 2025
@deepak1556
Copy link
Collaborator

Can users share a sample task configuration that repros this issue, tested with the following

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"isBackground": true,
			"command": ".\\node_modules\\.bin\\vite.cmd dev",
			"problemMatcher": [],
			"label": "vite dev",
			"detail": "run vite task"
		}
	]
}

Killing the terminal kills the task without issues.

@jibbers42
Copy link

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "npm: dev",
      "type": "npm",
      "script": "dev",
      // "isBackground": true,
      "presentation": {
        "panel": "dedicated",
        "reveal": "silent"
      },
      "runOptions": {
        "runOn": "folderOpen"
      },
      "problemMatcher": []
    }
  ]
}

I removed isBackground to see if that was the issue, but the node process continues running either way. I think I had type shell first and then tried the npm way, but I think it was just npm run dev so maybe not all that different from type npm.

@alikil
Copy link

alikil commented Mar 11, 2025

Not sure if it related to VSCode directly. But facing this issue from last week. So annoying.
All "npm run dev" commands not killing port by clicking ctrl+c
On "ExpressJS" (nodemon) and "NestJS" frameworks with hot reload functionality.

@meganrogge
Copy link
Contributor

meganrogge commented Mar 11, 2025

We're having trouble reproducing the issue. To help us narrow down what change caused the issue, please run the following command to find the build. It will start previous releases of VS Code insiders to see where the regression was introduced:

  • npx --yes @vscode/vscode-bisect@latest
  • follow the instructions until you found the offending build
  • report back the commit range in this issue

Thanks!

@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Mar 12, 2025
@vs-code-engineering vs-code-engineering bot added this to the March 2025 milestone Mar 12, 2025
@vs-code-engineering vs-code-engineering bot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Mar 12, 2025
@deepak1556
Copy link
Collaborator

Can users check if the issue is fixed in latest insiders https://code.visualstudio.com/insiders with "terminal.integrated.windowsUseConptyDll": false setting ?

@alikil
Copy link

alikil commented Mar 12, 2025

Version: 1.99.0-insider (user setup) | Version: 1.98.1 (user setup)

Commit: c1fb4c3
Date: 2025-03-12T08:28:07.410Z
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.26100

Not fixed.

Steps to reproduce (in my case):
npx kill-port 3000
npx kill-port 3001
Run both apps
Click kill button. (for both)
Run again -> (issue with port)

Tested with and without terminal.integrated.windowsUseConptyDll toggle:
Enabled toggle make ctrl+c faster. But not effect this issue. Problem only with "kill button"
Insider and usual version have same behaviour.

!!! New important info:
Ctrl+C working.
But button kill - not. This one on screenshot.

Temporary workaround: "Do not click kill button, use ctrl+c"

Image

Results:
App cannot launch again using same port.
netstat -an | find "3001"
TCP 0.0.0.0:3001 0.0.0.0:0 LISTENING
TCP [::]:3001 [::]:0 LISTENING
npx kill-port 3001 -> resolve issue and allow next start
Error in logs:
result.txt

@deepak1556 deepak1556 reopened this Mar 12, 2025
@vs-code-engineering vs-code-engineering bot removed the insiders-released Patch has been released in VS Code Insiders label Mar 12, 2025
@deepak1556
Copy link
Collaborator

@alikil thanks for checking, this was with "terminal.integrated.windowsUseConptyDll": false right ?

Can you provide the results of #242891 (comment), it would help us narrow down the regression.

@capc0
Copy link

capc0 commented Mar 12, 2025

Same behaviour for me when tasks are killed via command palette task: terminate task -> all running tasks. Tasks are not actually killed.

@meganrogge
Copy link
Contributor

meganrogge commented Mar 12, 2025

@capc0 Can you provide the results of #242891 (comment)?

@capc0
Copy link

capc0 commented Mar 12, 2025

I cant reproduce the behaviour within the npx --yes @vscode/vscode-bisect@latest opened versions of vscode.

@alikil
Copy link

alikil commented Mar 12, 2025

Link to github after full test. (npx --yes @vscode/vscode-bisect@latest)
1ba0fac...105d4af

vscode-bisect-logs.txt

@capc0
Copy link

capc0 commented Mar 12, 2025

For me the issue seems fixed in the insiders version. Cant reproduce the bug there at all.

In the normal version it is reproduceable everytime.

Same settings.json, same workspace, same extensions (but different extension verions maybe).

Image
{
    "terminal.external.windowsExec": "C:\\Program Files\\Git\\git-bash.exe",
    "terminal.integrated.defaultProfile.windows": "Git Bash"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug regression Something that used to work is now broken terminal-conpty Integrated terminal issues related to the ConPTY backend under-discussion Issue is under discussion for relevance, priority, approach windows VS Code on Windows issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants