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

Ctrl+C doesn't break out of an infinite loop while a cell is running. #9874

Closed
shangong opened this issue May 3, 2022 · 6 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Issue needs to be triaged

Comments

@shangong
Copy link

shangong commented May 3, 2022

Environment data

  • VS Code version: 1.53.0 insider
  • Jupyter Extension version (available under the Extensions sidebar): v2020.12.414227025
  • Python Extension version (available under the Extensions sidebar): v2021.1.431416030-dev
  • OS (Windows | Mac | Linux distro) and version: Mac
  • Python and/or Anaconda version: python 3.8.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Jupyter server running: Local

Expected behaviour

Ctrl+C should break out of an infinite loop while a cell is running.

Actual behaviour

Nothing happens with Ctrl+C. To restart, I have been resorting to restart the entire kernel instead.

Steps to reproduce:

Run an infinite loop in one of the notebook's cell, and try Ctrl+C. The cell will continue running and timeout after awhile.

@shangong shangong added the bug Issue identified by VS Code Team member as probable bug label May 3, 2022
@rchiodo
Copy link
Contributor

rchiodo commented May 3, 2022

Thanks for the bug.

What do you have 'CTRL+C' mapped to? 'CTRL+C' by default is mapped to copy so it wouldn't interrupt a cell.

Additionally what code are you running? Not all code is interruptable. Depends upon what the implementation of the code is.

@rchiodo rchiodo added the info-needed Issue requires more information from poster label May 3, 2022
@rchiodo
Copy link
Contributor

rchiodo commented May 3, 2022

Actually your version of VS code is rather old. You should upgrade to the latest and try your situation again. Please feel free to reopen if you're having trouble interrupting a cell with the latest bits.

@rchiodo rchiodo closed this as completed May 3, 2022
@greazer greazer added triage-needed Issue needs to be triaged and removed needs-triage labels May 16, 2022
@Ishaanjangid
Copy link

So what should we do when there is infinite loop executed by mistake in VS code

@rchiodo
Copy link
Contributor

rchiodo commented Apr 21, 2023

You would hit the interrupt button. Or map a keystroke to the interrupt button (this command here):

image

@gbromley
Copy link

For me, the interrupt button does not stop an infinite loop and still resorts to restarting the kernel.

@rchiodo
Copy link
Contributor

rchiodo commented Jul 19, 2023

For me, the interrupt button does not stop an infinite loop and still resorts to restarting the kernel.

That can happen if the kernel is running native code. In that case there may not be something listening to the messages for the interrupt. It can also depend upon what code you're running.

See this issue here:
ipython/ipython#3400

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants