JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.57k stars 5.48k forks source link

Ctrl-C during @less makes Julia hang then crash #36379

Open knuesel opened 4 years ago

knuesel commented 4 years ago

Steps to reproduce:

  1. @less sin(1)
  2. Press Ctrl-C
  3. Observe weird state: Julia shows the prompt, but less is still running.
  4. Press q to exit less. Julia hangs.
  5. Press Ctrl-C: Julia crashes.

A workaround for this particular case is to start Julia with PAGER='less -K', to make less exit on Ctrl-C.

Related issue: https://github.com/JuliaLang/julia/pull/14032

julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
ViralBShah commented 2 years ago

This doesn't reproduce for me.

knuesel commented 2 years ago

I can still reproduce it on Linux with slightly different steps (tested on the current master 9af12d3703):

  1. Execute @less sin(1). It shows the code in the pager.
  2. Press Ctrl-C. It doesn't exit the page.
  3. Quickly press Ctrl-C a few times. It exits the pager with WARNING: Force throwing a SIGINT.
  4. Press Enter. It looks like the REPL is in a corrupt state: it shows "(END)" at the bottom. The less instance is still running and reading from the keyboard.
  5. Press q. The prompt doesn't look quite right.
  6. Press Ctrl-C then Enter. Julia crashes.
ViralBShah commented 2 years ago

I suppose it depends on the pager you end up using.

vtjnash commented 2 years ago

We have handling for this in open(``), so perhaps we should add that same handling to run(wait=true)