You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Debug in python jump in other threads code while debug step by step #1792
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:
start a multthread python program
make a breakpoint in one thread
the editor stop in poin, after jump in another poin in another thread
Reacted by kevindehecker, gijsn, Yiğit Budak and Alireza Roshanzamir
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:
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.
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.
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.
Also experienced this with python 3.12, selecting the specific debugger version 2024.10.0 fixes the issue and the breakpoint stops on the correct thread, although this means jumping back two versions now so isn't a permanent solution.
Activity
EnricoBeltramo commentedon Dec 24, 2024
I verified that this bahaviour is not present with version of python debugger 2024.0.0
gijsn commentedon Jan 2, 2025
I can confirm the same issue with debugpy using the vscode python debugger.
Using:
When running the multi-threaded python program with debugger and breakpoint, it shows the following when stopped on the breakpoint:

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 commentedon 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 commentedon 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.
aprisely commentedon Jan 14, 2025
Also experienced this with python 3.12, selecting the specific debugger version 2024.10.0 fixes the issue and the breakpoint stops on the correct thread, although this means jumping back two versions now so isn't a permanent solution.