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

Interrupting kernel can only be used once #2158

Closed
CYHSM opened this issue Mar 15, 2020 · 8 comments
Closed

Interrupting kernel can only be used once #2158

CYHSM opened this issue Mar 15, 2020 · 8 comments
Assignees

Comments

@CYHSM
Copy link

CYHSM commented Mar 15, 2020

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Open a jupyter notebook
  2. Run following example code in a cell:
import time
for i in range(0, 100):
    try:
        print(i)
        time.sleep(0.5)
    except KeyboardInterrupt:
        print('You stopped run i={} early'.format(i))
        print('Hit interrupt button again if you want to exit')
        time.sleep(0.5)
  1. Try to interrupt kernel (before loop is finished)

Actual behavior

The above loop finishes although kernel was interrupted. This is a special case which I use for interrupting some loops while not interrupting the full process (therefore the KeyboardInterrupt). However, when I use jupyter notebook I can just call interrupt twice when I want to leave the loop. After calling it once in vscode the button for interruption is greyed out and I see a loading bar on top, can't restart kernel in this case and have to close the notebook and reopen it to restart the kernel.

Expected behavior

It would be nice to have the ability to interrupt the kernel until the kernel is actually interrupted. This is probably only an issue if somebody uses "except KeyboardInterrupt" but if it is possible to fix would be nice. Thanks.

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: happens Local & Remote
  • Extension version: 2020.2.64397
  • VS Code version: 1.43
  • Setting python.jediEnabled: false
  • Python and/or Anaconda version: Python 3.7.6
  • OS: Linux (ubuntu):
  • Virtual environment: conda
@y-x-c
Copy link

y-x-c commented Mar 16, 2020

I encountered the same problem as well. To reproduce the problem: run a cell (which takes for a while) and run this cell again before previous call ends. Now if we click the interrupt kernel, the first call will be interrupted, but the second call starts. At the mean while, the interrupt button greyed out and can not be clicked until I reopen the notebook.

@DavidKutu
Copy link

DavidKutu commented Mar 16, 2020

Thanks for the issue @CYHSM, we'll look into it.

I can also reproduce it on Windows.

@greazer
Copy link
Member

greazer commented Mar 19, 2020

To fix, let's not disable the interrupt button if it's clicked before the interrupt actually occurs.

@DonJayamanne DonJayamanne self-assigned this Apr 15, 2020
DonJayamanne referenced this issue in microsoft/vscode-python Apr 15, 2020
@rchiodo
Copy link
Contributor

rchiodo commented Apr 21, 2020

This is not fixed. The code in the issue still doesn't work.

@rchiodo
Copy link
Contributor

rchiodo commented Apr 21, 2020

For me the interrupt button works, but then two things happen:

  1. Interrupt button is disabled so I can't hit again
  2. A message shows up asking if I'd like to restart after 60 seconds.

DonJayamanne referenced this issue in microsoft/vscode-python Apr 28, 2020
@IanMatthewHuff IanMatthewHuff self-assigned this May 7, 2020
@IanMatthewHuff
Copy link
Member

Doesn't look validated to me. I see the same thing that Rich was seeing where the button is enabled, but the second interrupt never happens and eventually I get a message saying that the interrupt failed and I can restart instead. Tested in raw and jupyter.

@IanMatthewHuff
Copy link
Member

Was previously in may nice to have, so moving to june nice to have.

@rchiodo rchiodo self-assigned this Jun 10, 2020
@IanMatthewHuff IanMatthewHuff self-assigned this Jun 17, 2020
@IanMatthewHuff
Copy link
Member

Validated, double interrupts allowed now.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
@microsoft microsoft unlocked this conversation Nov 13, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants