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

Pyhon debugger stops at removed breakpoint #16406

Open
paul-rogers opened this issue Jan 28, 2025 · 2 comments · Fixed by #16414
Open

Pyhon debugger stops at removed breakpoint #16406

paul-rogers opened this issue Jan 28, 2025 · 2 comments · Fixed by #16414
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug notebook-debugging triage-needed Issue needs to be triaged verification-found Issue verification failed
Milestone

Comments

@paul-rogers
Copy link

paul-rogers commented Jan 28, 2025

Type: Bug

The Python debugger in the VS Code Juypter extension does not recognize when the last breakpoint in a notebook is removed. To see this, create a new notebook and choose a Python kernel. Create two cells:

Cell 1:

def fib(n):
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)

Cell 2:

fib(5)
  • Set a breakpoint at the if statement in fib(.).
  • From cell 2, choose Debug Cell. The debugger will stop at your breakpoint.
  • Remove the breakpoint and click Continue (or press F5, if that is your binding.)
  • The debugger will again stop at your now-deleted breakpoint. It will do this each time you click Continue.
  • Once execution completes, again choose Debug Cell in cell 2. This time, the debugger runs without stopping at the phantom breakpoint.

It seems the debugger cannot handle the situation in which we go from one to zero breakpoints. Modify the function above to:

def fib(n):
    if n < 0:
        raise Exception("Invalid input")
    if n < 2:
        return n
    return fib(n-1) + fib(n-2)
  • Set a breakpoint on the if n < 2 line as above.
  • Choose Debug Cell on the second cell. The debugger stops as before.
  • This time, remove the breakpoint, and add a new one on the raise line.
  • Click Continue (or hit F5). The debugger happily runs the rest of the code without stopping.

This is not a new bug: it has been happening for many months on multiple versions of VS Code, extensions and Python.

Extension version: 2024.11.0
VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Linux x64 6.8.0-51-generic
Modes:

System Info
Item Value
CPUs AMD Ryzen 7 9700X 8-Core Processor (16 x 5540)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 60.44GB (35.46GB free)
Process Argv --crash-reporter-id 5e232e7b-355a-468c-ac4a-02c300f898bd
Screen Reader no
VM 0%
DESKTOP_SESSION cinnamon
XDG_CURRENT_DESKTOP X-Cinnamon
XDG_SESSION_DESKTOP cinnamon
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupytercf:31046870
2f103344:31071589
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127
9064b325:31222308
copilot_t_ci:31222730

@DonJayamanne DonJayamanne added bug Issue identified by VS Code Team member as probable bug notebook-debugging triage-needed Issue needs to be triaged labels Jan 28, 2025
@DonJayamanne DonJayamanne added this to the February 2025 milestone Feb 3, 2025
@eleanorjboyd eleanorjboyd added the verification-found Issue verification failed label Feb 26, 2025
@eleanorjboyd eleanorjboyd reopened this Feb 26, 2025
@eleanorjboyd
Copy link
Member

Found this behavior when I tested:

Set a breakpoint at the if statement in fib(.).
From cell 2, choose Debug Cell. The debugger will stop at your breakpoint.
Remove the breakpoint and click Continue
The debugger will again stop at your now-deleted breakpoint. It will do this each time you click Continue.

@paul-rogers paul-rogers changed the title Pytrhon debugger stops at removed breakpoint Pyhon debugger stops at removed breakpoint Feb 26, 2025
@paul-rogers
Copy link
Author

@eleanorjboyd, thanks for the repro! Good to know it is not just some quirk of my setup.

I just repeated the steps from the description. The behavior still occurs in the latest VS Code and extensions.

Version: 1.97.2 Commit: e54c774e0add60467559eb0d1e229c6452cf8447 Date: 2025-02-12T23:20:35.343Z Electron: 32.2.7 ElectronBuildId: 10982180 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Linux x64 6.8.0-53-generic

Jupyter extension version: 2025.1.0 (2025-02-07, 02:08:52)

OS is Linux Mint, latest version. updated since the initial bug report: now runs on Wayland rather than X.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug notebook-debugging triage-needed Issue needs to be triaged verification-found Issue verification failed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants