Skip to content

Step Over, Step Into, and Step Out not working when debugging Flask app served locally using gunicornΒ #544

@jdwestwood

Description

@jdwestwood

Version: 1.96.2 (user setup)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.19045

Running in Win10/WSL2 with Python 3.12.
VSCode Python Debugger v2024.12.0 and later, up though the current pre-release v2024.15.2024121701.

In launch.json, I have the following (simplified) config for debugging my Flask app using gunicorn[gevent] v23.0.0 (the latest version) to serve it locally:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch gunicorn",
            "type": "debugpy",
            "request": "launch",
            "python": "/path/to/python/venv/bin/python3.12",
            "program": "/path/to/python/venv/bin/gunicorn",
            "cwd": "${workspaceFolder:flask_app}",
            "gevent": true,
            "args": ["startup:app",
                     "--bind=localhost:8080",
                     "--workers=1",
                     "--worker-class=gevent"],
        },
}

A simplified version of the entry-point file startup.py that reproduces the bug is:

# Set a breakpoint 1 here.
a = 1

# Step Over or Step In to here.
b = 2

# Set breakpoint 2 here.
c = 3

# For the purpose of illustrating the bug, these lines can be commented out.
# from flask import Flask
# app = Flask('Flask_App')

In Python Debugger v2024.10.0, when I launch "Launch gunicorn" everything works as expected: after hitting breakpoint 1, I can "Step Over" or "Step In" to b = 2.

In Python Debugger v2024.12.0 and subsequent releases, execution stops as expected at breakpoint 1, but clicking "Step Over" or "Step In" causes execution to resume until breakpoint 2 is hit.

For the time being as a workaround, I have pinned Python Debugger at v2024.10.0.

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions