bduggan / raku-jupyter-kernel

Raku Kernel for Jupyter notebooks
Artistic License 2.0
74 stars 18 forks source link

Feature: Ctrl-c should kill the pending IO and not the full kernel #75

Closed tinmarino closed 4 years ago

tinmarino commented 4 years ago

On a Slow IO, pressing cltr-c should be handled and interupt the IO but not the full kernel. The roadmap is to copy IPython implementation:

In [1]: /home2/tourneboeuf/.local/lib/python3.7/site-packages/jupyter_console/ptshell.py:713: UserWarning: The kernel did not respond to an is_complete_request. Setting use_kernel_is _complete to False. warn('The kernel did not respond to an is_complete_request. '


* Ipython (kernel survive)

In [3]: sleep(10)
^C--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last)

in ----> 1 sleep(10) KeyboardInterrupt: In [4]: 13 Out[4]: 13 ```
tinmarino commented 4 years ago

Long Journey => Be sure to -Ofun (jnthn)

  1. Some longjmp are present in the MoarVm (Dig deeper is the language stack)
  2. The try catch is THE solution. The exception must come from a side channel (see how other kernel handle the situation)

Hard Challenge => If you keep on until success, you will succeed before you stop

bduggan commented 4 years ago

I see the same behavior that you do. To me it's strange that ctrl-c in the console client even sends a SIGINT to the kernel; it seems like this should behave the same way that clicking 'interrupt' in the web client would (send a shutdown request to the kernel). I would be okay with just treating ctrl-c as a shutdown+restart request. It's not ideal, but it's better than the current behavior. Also as Jonathan pointed out there's no good way to deal with typing ctrl-c when the console code is starting threads other than hooking into the scheduler...and since this is raku, what if the console code is modifying $*SCHEDULER :-)

tinmarino commented 4 years ago

It is too hard, plus the same issue appears in rakudo REPL. So ... I admit I .... abandon !

bduggan commented 4 years ago

I opened #84 which makes the experience a little better -- I think it's a reasonable solution -- and I haven't seen any negative effects of doing the eval on another thread.