microsoft / microsoft/vscode-python-debugger

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

Open
#544 8 comments 2 reactions 1 assignee View on GitHub

@eleanorjboyd is already working on this.

Since Jan 14, 2025.

triage-needed
Dominant language
TypeScript
Stars
181
Forks
126
Avg merge
2d 3h
Merged PRs (30d)
3

Description

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.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.