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

Python Debugger Attached to Azure Functions App Hangs Indefinitely at Breakpoint #1685

Open
JetPlaneJJ opened this issue Sep 27, 2024 · 3 comments
Assignees
Labels
needs repro Issue has not been reproduced yet user responded

Comments

@JetPlaneJJ
Copy link

JetPlaneJJ commented Sep 27, 2024

Issue Type: Bug

Behavior

When attached to a local process running Azure Functions, the python debugger gets stuck indefinitely at a set breakpoint, and there is no response to clicking step forward button etc. The variables window is also empty and loads indefinitely.

Setup

VS Code:

Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

**
Python version: 3.9.7
Python VS Code extension version: v2024.14.1
Azure Functions VS Code extension version: v1.15.4
Azure Core Tools version: 4.0.6280**

launch.json

{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "debugpy",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}
tasks.json
...
"tasks": [
{
"type": "func",
"label": "func: host start",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
"dependsOrder": "sequence",
"dependsOn": ["pip install (functions)"],
...
}, ...
...

Steps to reproduce:

  1. Click "Run and Debug" to run launch.json "Attach to Python Functions", which will start local Azure Functions serverless app via command 'func host start' and attach to that process.
  2. Set breakpoint anywhere in any Function
  3. Trigger the breakpoint
  4. Debugger hangs indefinitely and cannot see local or global variables. Cannot exit process through CTRL+C. This happens inconsistently, may sometimes step through normally in the same breakpoint without changing the code.
  5. Debug console is also unresponsive (try typing any command while stuck at breakpoint like print("test") and there is no output)
  6. Need to restart Azure Functions App by clicking terminal trash can button or "detach" button in debug menu to get unstuck.

Things tried

  1. Switch Python extension version to pre-release
  2. Restart VS code
  3. Re-install Azure Functions extension
  4. Re-install Azure Core Tools

Screencapture

20240927134944.mp4
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python-debugger Sep 30, 2024
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Sep 30, 2024
@rchiodo
Copy link
Contributor

rchiodo commented Sep 30, 2024

Sorry but I can't reproduce your problem. I tried an example azure function and it works fine.

Can you share some code that causes the issue?

@rchiodo
Copy link
Contributor

rchiodo commented Sep 30, 2024

If you set this value it might also give us some idea what the problem is:

"logToFile": true

That should generate log files in your python debugger extension's folder. Something like so:

C:\Users\rchiodo\.vscode\extensions\ms-python.debugpy-2024.11.2024092501-win32-x64

@wookayin
Copy link

wookayin commented Oct 7, 2024

Also try using py-spy to see where the python process is stuck. Does setting "subprocess": false help by any chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet user responded
Projects
None yet
Development

No branches or pull requests

3 participants