Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Remote attach debug server not dying upon killing the attached process

Open
#1,783 19 comments 0 reactions 1 assignee View on GitHub

@StellaHuang95 is already working on this.

Since Dec 16, 2024.

Assessment

This issue has not been assessed yet.

Description

bug needs repro

Type: Bug

Behaviour

Extremely frequently the VS Code remote attach debugger will not die when I kill the python -m debugpy ... process that is attaching to the port 5678. Until I restart the IDE I cannot start debugging again, because otherwise it will complain that "Python debugger is already debugging another instance". My colleaques haven experiened this issue as well, and it seems to be a recent regression (last couple of weeks).

As I wrote this, I cannot click the "Create on GitHub" button because VSCode is seeming unresponsive. I resolved by restarting the IDE.

Steps to reproduce:

  1. Use the below config for debugger
  2. Run python -m debugpy --wait-for-client --listen 5678 /path/to/module.py
  3. Run debugger
  4. Either detach debugger or CTRL-C the process on command line

Diagnostic data

launch.json configuration

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Remote Attach",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "."
                }
            ],
            "justMyCode": false
        }
    ]
}

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

Output for Python Debugger in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python Debugger)

XXX

Extension version: 2024.15.2024121301
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 4.18.0-372.32.1.el8_6.x86_64
Remote OS version: Linux x64 4.18.0-372.32.1.el8_6.x86_64
Remote OS version: Linux x64 4.18.0-372.32.1.el8_6.x86_64
Connection to 'SSH: zbs-carp2' could not be established Canceled
Remote OS version: Linux x64 4.18.0-372.32.1.el8_6.x86_64

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.19
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz (16 x 2611)
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) 63.73GB (37.47GB free)
Process Argv --folder-uri vscode-remote://ssh-remote%2Bzbs-carp2/physical/gpfs/carp2-home/car_home02/data_files/jcs/zsilversmith/dev/git/eis3 --crash-reporter-id 2a67a766-b9ca-442f-87e6-12fdf4c1e37f
Screen Reader no
VM 0%
Item Value
Remote SSH: zbs-carp2
OS Linux x64 4.18.0-372.32.1.el8_6.x86_64
CPUs AMD EPYC 7763 64-Core Processor (128 x 0)
Memory (System) 2014.91GB (1217.89GB free)
VM 0%
Item Value
Remote SSH: zbs-carp2
OS Linux x64 4.18.0-372.32.1.el8_6.x86_64
CPUs AMD EPYC 7763 64-Core Processor (128 x 0)
Memory (System) 2014.91GB (1217.89GB free)
VM 0%
Item Value
Remote SSH: zbs-carp2
OS Linux x64 4.18.0-372.32.1.el8_6.x86_64
CPUs AMD EPYC 7763 64-Core Processor (128 x 0)
Memory (System) 2014.91GB (1217.89GB free)
VM 0%

Connection to 'SSH: zbs-carp2' could not be established Canceled

Item Value
Remote SSH: zbs-carp2
OS Linux x64 4.18.0-372.32.1.el8_6.x86_64
CPUs AMD EPYC 7763 64-Core Processor (128 x 0)
Memory (System) 2014.91GB (1217.89GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624

Dominant language
Python
Stars
2.5k
Forks
202
Avg merge
5d 1h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/debugpy

All issues in microsoft/debugpy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.