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

Debug in python jump in other threads code while debug step by step #1792

Closed
EnricoBeltramo opened this issue Dec 24, 2024 · 4 comments
Closed
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@EnricoBeltramo
Copy link

Does this issue occur when all extensions are disabled?: Yes/No yes

  • VS Code Version: 1.96.2
  • OS Version: win11

After year that I use vscode without problems to debug python, in latest versions I have problem placing breakpoints in a python multithread program. I have a program with many background threads and now when I set a breakpoint in one of those thread, the ide first break in correct point, after immediately jump in a point in other threads that I'm not interested in, making the debugger unusable. Is a new behaviour? Can be avoided?
Steps to Reproduce:

  1. start a multthread python program
  2. make a breakpoint in one thread
  3. the editor stop in poin, after jump in another poin in another thread
@EnricoBeltramo
Copy link
Author

I verified that this bahaviour is not present with version of python debugger 2024.0.0

@kieferrm kieferrm assigned karthiknadig and unassigned roblourens Dec 24, 2024
@karthiknadig karthiknadig removed their assignment Dec 24, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode Dec 24, 2024
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Dec 24, 2024
@gijsn
Copy link

gijsn commented Jan 2, 2025

I can confirm the same issue with debugpy using the vscode python debugger.
Using:

  • VSCode 1.96.2 (issue also exists on older versions)
  • Python 3.13.1 (Issue also exists on python 3.12)

When running the multi-threaded python program with debugger and breakpoint, it shows the following when stopped on the breakpoint:
Image
Note, I cannot manually cause this to happen. when I manually step in a file, it will remove the 'Paused on Breakpoint' text and just say 'Paused'

The program stops on the breakpoint, and then steps once in a secondary thread, causing the 'paused on step' without my interaction. VSCode will show the usual yellow arrow and highlighted line in the file of the second thread (logger). The program is also stopped on the breakpoint (initial stopping cause), but does not open the file to indicate the location. I have to manually open the file with breakpoint, which is also indicating the stopped location (at the breakpoint) with the yellow highlight and arrow once opened.

As @EnricoBeltramo mentions, the issue does not exist on 2024.0.0.

Thanks

@yibudak
Copy link

yibudak commented Jan 4, 2025

I'm facing the same problem. The debugger randomly jumps to another thread's line, even though there is no breakpoint. Is there any way to fix this? It makes debugging impossible.

Edit: I've downgraded debugpy to version 2024.10.0, it works as expected.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 6, 2025

This should be a dupe of #1765. If downgrading to 2024.10.0, fixes it, it must be something with the new sys.monitoring support. Another temporary workaround would be to use 3.11 instead of 3.12 as that usess the old code path.

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
Projects
None yet
Development

No branches or pull requests

7 participants