microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.25k stars 275 forks source link

Can't interrupt running cell after continuing debug session #13006

Closed johnmbarrett closed 6 months ago

johnmbarrett commented 1 year ago

Applies To

What happened?

It is impossible to interrupt the kernel after debugging a cell, hitting a breakpoint, and then continuing. Instead, you have to wait for the cell to finishing executing before you can run it again or restart the kernel. This can be problematic when debugging long-running calculations

Steps to reproduce

1) Install this repository: https://github.com/caleb531/automata 2) Create a new Python notebook 3) Create a new cell and enter the following code:

from automata.tm.dtm import DTM

dtm = DTM(
    states={'S','a','b','c','d','e','f','H'},
    input_symbols={'1'},
    tape_symbols={'0','1'},
    transitions={
        'S': {
            '0': ('a', '0', 'N'),
            '1': ('a', '0', 'N')
        },
        'a': {
            '0': ('b', '1', 'R'),
            '1': ('d', '0', 'L')
        },
        'b': {
            '0': ('c', '1', 'R'),
            '1': ('f', '0', 'R')
        },
        'c': {
            '0': ('c', '1', 'L'),
            '1': ('a', '1', 'L')
        },
        'd': {
            '0': ('e', '0', 'L'),
            '1': ('H', '1', 'R')
        },
        'e': {
            '0': ('f', '1', 'L'),
            '1': ('b', '0', 'R')
        },
        'f': {
            '0': ('c', '0', 'R'),
            '1': ('e', '0', 'R')
        }
    },
    initial_state='a',
    blank_symbol='0',
    final_states={'H'}
)

dtm.read_input('1')

4) Add a breakpoint on the last line 5) Select 'Debug cell' from the little drop down next to the arrowhead by the top left corner of the cell 6) Wait for the breakpoint to be hit 7) Hit the blue continue button that looks like a right-pointing arrowhead with a line next to it 8) Hit the square interrupt button by the top left corner of the cell

Expected behaviour

Cell execution is interrupted

Actual behaviour

Cell execution continues (in this specific case, for a very long time)

Additional info

See attached video for a demonstration of the behaviour. Despite pressing the interrupt button twice and attempting to restart the kernel, the cell still appears to be running.

https://user-images.githubusercontent.com/19190699/223289351-7d8d0b49-1ebd-45e0-9e4b-1f9695b6f575.mp4

Disconnecting from the debug session (with the red disconnected plug icon) allows interrupting, but it is not possible to disconnect from the debug session after continuing as far as I can tell.

Appears to be specific to pre-release version v2022.10.1103011060 as downgrading to the current release v2022.9.1303220346 fixes it. However, that is not an acceptable workaround as v2022.10.1103011060 introduced the jupyter.debugJustMyCode config option, which I make frequent use of.

I tried searching for this specific issue on Google and in the GitHub issues, but couldn't find any other reports of this exact issue. Apologies if I've overlooked something.

VS Code Version

Version: 1.72.2 Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075 Date: 2022-10-12T22:16:26.920Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 5.15.0-48-generic Sandboxed: No

Jupyter Extension Version

v2022.10.1103011060

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.9.0

Language Extension Version (if applicable)

Python v2022.16.1

Anaconda Version (if applicable)

conda 4.12.0

Running Jupyter locally or remotely?

Local

roblourens commented 1 year ago

This is supposed to do an interrupt, seems like that's not happening

DonJayamanne commented 6 months ago

I can no longer rpro this issue, if you still run into this, please do ping here and I'll reopen this issue or feel free to create a new issue.