microsoft / vscode-jupyter

VS Code Jupyter extension

Home Page:https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code sys.exit() causes interactive terminal to freeze with kernel crash

capt-watson opened this issue · comments

Type: Bug

When sys.exit() code is executed by clicking on close [X] button while the python program is running in main file, the jupyter interactive-1 window freezes followed by kernel crash.

However, when the same program file is run with default output set to be from dedicated terminal, the program terminates without any issues such vs code freeze or kernel crash.

Extension version: 2024.4.2024041101
VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z)
OS version: Windows_NT x64 10.0.22635
Modes:

System Info
Item Value
CPUs AMD Ryzen 5 5625U with Radeon Graphics (12 x 2296)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.34GB (7.95GB free)
Process Argv --crash-reporter-id 484abd28-e8b1-4de9-965b-4ca954c1dad6
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
gee8j676:31009558
chatpanelc:31018788
dsvsc021:30996838
f3je6385:31013174
pythoncenvpt:31022790

I"m struggling to understand this issue.

When sys.exit() code is executed by clicking on close [X] button while the python program

I don't understand how sys.exit is excuted when clicking an x button, what x button?

Please can you share a screen recording of the issue, you can use https://gifcap.dev/ to record the screen.

Please find attached video of the issue for your perusal.

Recording 2024-04-30 at 18 44 41

The game page screenshot is attached here as it was not captured by the screen recorder.

Game_page

Please can you try running the exact same code in Jupyter Lab or Jupyter Notebook and see if the issue repros in there.
If it does, please can you share the terminal output.

@DonJayamanne Thank you for reply.

I have tried running the above code in my Jupyter Notebook but the result is exactly as shown in my previous screen-recoding attached above.

Now I have also attached a new screen-recoding for your perusal.

Please do let me know if require any further details.

Recording 2024-05-01 at 07 31 29

I have tried running the above code in my Jupyter Notebook but the result is exactly as shown in my previous screen-recoding attached above.

I'm referring to Jupyter Lab application thats launched outside VS Code.
This is what I'm referring to https://jupyter.org/

@DonJayamanne Unfortunately, I do not use stand alone Jupyter Notebook application as I work on various programming languages and VS code suits me fine for this purpose.

I have a suggestion. As Google Colab uses Jupyter Notebook application, I can run this code in Google Colab and send you the result. Will this serve the purpose? Kindly let me know.

Would it be possible to run pip install jupyterlab in your Python environment and then test this.
& then run python -m jupyter lab from that environment to launch Jupyter and test thsi in a notebook.

I do not believe this is an issue with VS Code, hence the suggestion to try Jupyter Lab or Jupyter Notebook.
Google Colab is slightly different, as there are some subtle differences.

@DonJayamanne As I already had Jupyter Notebook installed via pip, I could run my program from the Jupyter Notebook. But still no changes in the outcome. Jupyter Notebook is still throwing the same error and causing the kernel to crash.

If you remember, I had in my very first ticket mentioned that I am facing this issue only when I try to get the output from the Jupyter Interactive Terminal. I am always able to get the desired output from my VS code terminal without any issues.

Fyi, I have attached a copy of the screen recording of the time when I tried to run my program from the Jupyter Notebook which caused my Kernel to crash. Unfortunately, your screen recorder is unable to capture the game viewer pop-up page.

Recording 2024-05-01 at 15 38 29

Fyi, I have attached a copy of the screen recording of the time when I tried to run my program from the Jupyter Notebook which caused my Kernel to crash.

Thanks for testing this in Jupyter notebooks.
This confirms my initial hypothesis, given that it crashes outside vscode is not caused by vscode nor the jupyter extension.
I would suggest trying stack overflow or the like to try and get to the bottom of this issue.