Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Run remote Debug success,But restart Debug errorInfo-show: connect ECONNREFUSED ip-address:5678

Abierto
#1,582 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python, vscode
Área
devtools

Línea de trabajo

Reproduce el flujo de remote attach y reinicio usando launch.json, task.json y main.py, comenzando por las llamadas a debugpy.listen() y debugpy.wait_for_client(). Comprueba cómo se inicia el segundo attach después de la primera sesión y verifica que el reinicio preserve la conexión en lugar de producir ECONNREFUSED en el puerto 5678.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Environment data

  • OS: Ubuntu 22.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10
  • debugpy version:1.8.1
  • Using VS Code or Visual Studio: VSCode 1.88.1, Terminal

Actual behavior

I can connect normally with debugging and debugging normally,But click to re -debug, you will prompt an error and exit the debugging

Expected behavior

If I click to restart the debugging, I should continue the normal debugging process
屏幕截图 2024-05-11 151348

error: connect ECONNREFUSED ip-address:5678
屏幕截图 2024-05-11 145746

Steps to reproduce:

vscode:
launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "connect to remote server",
            "type": "debugpy",
            "request": "attach",
            "preLaunchTask": "Run_Python",
            "connect": {
                "host": "ip-address",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "/home/xxx/py/py/"
                }
            ],
            "justMyCode": true
        }
    ]
}

task.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Run_Python",
            "type": "shell",
            "command": "ssh -tt xxx@ip-address 'python /home/xxx/py/py/main.py'",
            "args": [],
            "isBackground": true,
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": {
                "owner": "python",
                "source": "debugpy",
                "fileLocation": [
                    "relative",
                    "${workspaceFolder}"
                ],
                "pattern": [
                    {
                        "regexp": "\\s+(.*)$",
                        "message": 1
                    },
                    {
                        "regexp": "Connection to closed",
                        "file": 1,
                        "line": 1,
                        "column": 1
                    }
                ],
                "background": {
                    "activeOnStart": false,
                    "beginsPattern": {
                        "regexp": "start"
                    },
                    "endsPattern": {
                        "regexp": "Waiting for debugger attach"
                    }
                }
            },
            "presentation": {
                "echo": true,
                "panel": "shared",
                "focus": true,
                "clear": true
            }
        }
    ]
}

code:

print("start")
import debugpy

# 5678 is the default attach port in the VS Code debug configurations. Unless a host and port are specified, host defaults to 127.0.0.1
debugpy.listen(('0.0.0.0', 5678))
print("Waiting for debugger attach")
debugpy.wait_for_client()
debugpy.breakpoint()
def add_fun(a, b):
    a = a * 10
    b = b * 100
    c = a + b
    return c

if __name__ == '__main__':
    a = 10
    b = 78
    c = add_fun(a, b)
    c = c
    print(f"a + b = {c}")
Lenguaje dominante
Python
Estrellas
2.5k
Forks
202
Merge medio
5 d 1 h
PR fusionados (30 d)
1

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/debugpy

Todos los issues de microsoft/debugpy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.