how to kill kernel for preview with an infinite loop?

Open
#5,141 4 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Apr 10, 2023.

Assessment

This issue has not been assessed yet.

Description

engines-jupyter enhancement preview
Bug description

Suppose you've got the following in test.qmd:

---
title: Test
jupyter:
  jupytext:
    formats: 'ipynb,md'
  kernelspec:
    display_name: Python 3 (ipykernel)
    language: python
    name: python3
---

```{python}
while True:
    pass
```

and then you, ill-advisedly, run

quarto preview test.qmd

After the machine spins for a bit you realize your error and hit ^C. This kills quarto but not (apparently, on my machine;
Debian 6.1.7-1 (2023-01-18) x86_64 GNU/Linux) the python kernel (which is still visible in top, for instance).

Changing the cell to

```{python}
while True:
    break
```

instead and re-running quarto preview test.qmd does not get python out of its infinite loop; neither does doing the same change without having killed quarto. I haven't found a way to kill the python kernel besides finding the PID from top and killing it manually.

Is there a better way to deal with this (besides daemon: false in the config)?

ps. I can deal with this with only minor annoyance; but this seems major - I'd not want to assign my stats class to use quarto knowing they could well hit this, for instance.

$ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.313
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.2
      Path: /usr/bin/python3
      Jupyter: 4.12.0
      Kernels: ir, python3

(\) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.2
      Path: /usr/lib/R
      LibPaths:
        - /home/peter/R
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.36
      rmarkdown: 2.21

[✓] Checking Knitr engine render......OK
Checklist
  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.
  • Please provide the output of quarto check so we know which version of quarto and its dependencies you're running.
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/quarto-cli

All issues in quarto-dev/quarto-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.