tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

breaking infinite or long-running repl evaluations #182

Closed verydapeng closed 10 years ago

verydapeng commented 10 years ago

connected via nrepl (started by lein repl)

(interate inc 0)

:Eval the code above, ctrl-c break the command, however the background evaluation still goes on, CPU usage goes 100%

if we do the same inside lein repl console, CPU will come back normal after hitting ctrl-c

tpope commented 10 years ago

Do you have +python in :version?

verydapeng commented 10 years ago

here is my :version

normal code evaluation is fine, it is only I need a way to break some lengthy evals

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  2 2014 19:39:47)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +dialog_con_gui  +insert_expand   +mouse_sgr       +ruby            +vertsplit
+arabic          +diff            +jumplist        -mouse_sysmouse  +scrollbind      +virtualedit
+autocmd         +digraphs        +keymap          +mouse_urxvt     +signs           +visual
+balloon_eval    +dnd             +langmap         +mouse_xterm     +smartindent     +visualextra
+browse          -ebcdic          +libcall         +multi_byte      -sniff           +viminfo
++builtin_terms  +emacs_tags      +linebreak       +multi_lang      +startuptime     +vreplace
+byte_offset     +eval            +lispindent      -mzscheme        +statusline      +wildignore
+cindent         +ex_extra        +listcmds        +netbeans_intg   -sun_workshop    +wildmenu
+clientserver    +extra_search    +localmap        +path_extra      +syntax          +windows
+clipboard       +farsi           +lua             +perl            +tag_binary      +writebackup
+cmdline_compl   +file_in_path    +menu            +persistent_undo +tag_old_static  +X11
+cmdline_hist    +find_in_path    +mksession       +postscript      -tag_any_white   -xfontset
+cmdline_info    +float           +modify_fname    +printer         +tcl             +xim
+comments        +folding         +mouse           +profile         +terminfo        +xsmp_interact
+conceal         -footer          +mouseshape      +python          +termresponse    +xterm_clipboard
+cryptv          +fork()          +mouse_dec       -python3         +textobjects     -xterm_save
+cscope          +gettext         +mouse_gpm       +quickfix        +title           +xpm
+cursorbind      -hangul_input    -mouse_jsbterm   +reltime         +toolbar
+cursorshape     +iconv           +mouse_netterm   +rightleft       +user_commands
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
verydapeng commented 10 years ago

in light table eval the follow codes

(recur)

CPU goes 100%

issue command "Eval: Cancel evaluation for the current client"

it breaks the evaluation with this

java.lang.ThreadDeath: null
                 Thread.java:850 java.lang.Thread.stop
      interruptible_eval.clj:192 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval[fn]
               middleware.clj:17 clojure.tools.nrepl.middleware/wrap-conj-descriptor[fn]
                    eval.clj:224 lighttable.nrepl.eval/eval2493[fn]
                MultiFn.java:227 clojure.lang.MultiFn.invoke
                  handler.clj:48 lighttable.nrepl.handler/lighttable-ops[fn]
               middleware.clj:17 clojure.tools.nrepl.middleware/wrap-conj-descriptor[fn]
                 session.clj:192 clojure.tools.nrepl.middleware.session/session[fn]
               middleware.clj:17 clojure.tools.nrepl.middleware/wrap-conj-descriptor[fn]
                   server.clj:18 clojure.tools.nrepl.server/handle*
                   server.clj:27 clojure.tools.nrepl.server/handle[fn]
                   core.clj:1910 clojure.core/binding-conveyor-fn[fn]
                     AFn.java:18 clojure.lang.AFn.call
             FutureTask.java:266 java.util.concurrent.FutureTask.run
    ThreadPoolExecutor.java:1142 java.util.concurrent.ThreadPoolExecutor.runWorker
     ThreadPoolExecutor.java:617 java.util.concurrent.ThreadPoolExecutor$Worker.run
                 Thread.java:745 java.lang.Thread.run
tpope commented 10 years ago

There is code to tell nREPL to abort the eval on Ctrl-C. I can confirm it's not firing in this case.

jstokes commented 9 years ago

Did this crop back up? I'm on the latest build of vim-fireplace, running (iterate inc 0)

And trying to Ctrl-C does not interrupt the running process - vim just hangs until I get a OOM.

tpope commented 9 years ago

Just tried and it still works for me. I wouldn't be surprised if there was some fiddling platform issue hiding somewhere.

jstokes commented 9 years ago

You're right - thanks for checking. A plugin I was using had remaped C-c in normal mode and was catching it. Commenting that line out and I can now stop evaluation.