YouCompleteMe
YouCompleteMe copied to clipboard
When YouCompleteMe is installed, the ":sleep 10" comamnds is no longer interruptible with CTRL-C
Issue Prelude
Please complete these steps and check these boxes (by putting an x
inside
the brackets) before filing your issue:
- [x] I have read and understood YCM's CONTRIBUTING document.
- [x] I have read and understood YCM's CODE_OF_CONDUCT document.
- [x] I have read and understood YCM's README, especially the Frequently Asked Questions section.
- [x] I have searched YCM's issue tracker to find issues similar to the one I'm about to report and couldn't find an answer to my problem. (Example Google search.)
- [x] If filing a bug report, I have included the output of
vim --version
. - [x] If filing a bug report, I have included the output of
:YcmDebugInfo
. - [ ] If filing a bug report, I have attached the contents of the logfiles using
the
:YcmToggleLogs
command. - [x] If filing a bug report, I have included which OS (including specific OS version) I am using.
- [ ] If filing a bug report, I have included a minimal test case that reproduces
my issue, using
vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I expected to happen and what actually happened. - [ ] If filing a installation failure report, I have included the entire output
of
install.py
(orcmake
/make
/ninja
) including its invocation - [x] I understand this is an open-source project staffed by volunteers and that any help I receive is a selfless, heartfelt gift of their free time. I know I am not entitled to anything and will be polite and courteous.
- [x] I understand my issue may be closed if it becomes obvious I didn't actually perform all of these steps.
Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
When YouCompleteMe is installed, a :sleep 10
command (which sleeps
for 10 seconds) is no longer interruptible by pressing CTRL-C.
Without the YouCompleteMe plugin, the same :sleep 10
command
is interruptible with CTRL-C. :help sleep
explicitly says that CTRL-C
should insterrupt it.
I have no idea what YouCompleteMe is doing to prevent interrupting
:sleep 10
with CTRL-C. I am not sure whether it's a bug in YouCompleteMe
or in Vim. I have several other plugins installed, but only YouCompleteMe
has this issue.
- What did you do?
Use this minimalistic ~/.vimrc
(which uses https://github.com/junegunn/vim-plug plugin manager):
$ cat ~/.vimrc
call plug#begin()
Plug 'ycm-core/YouCompleteMe'
call plug#end()
Then run vim and use the :sleep 10
command to sleep for 10 seconds.
Trying pressing CTRL-C.
- What did you expect to happen?
I would expect CTRL-C to interrupt the sleep. It works when disabling YouCompleteMe.
- What actually happened?
CTRL-C does not interrupt the sleep. Vim is not responsive until the 10 second sleep completes.
Diagnostic data
Output of vim --version
$ ./vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 9 2020 19:14:11)
Included patches: 1-2123
Compiled by pel@pel-cirrus7
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl +title
+clientserver +job +persistent_undo -toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape -lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent +X11
-dnd +mouse +sound +xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval +mouse_gpm +statusline +xsmp_interact
+ex_extra -mouse_jsbterm -sun_workshop +xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang-12 -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang-12 -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm
Output of YcmDebugInfo
Printing YouCompleteMe debug information...
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_uuhthkb6.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.6.9
-- Server has Clang support compiled in: True
-- Clang version: clang version 11.0.0 ([email protected]:ycm-core/llvm ff1d9b2bb8f62
c1924db137b544598b8e974ada8)
-- No extra configuration file found
-- C-family completer debug information:
-- Clangd running
-- Clangd process ID: 529
-- Clangd executable: ['/home/pel/.vim/plugged/YouCompleteMe/third_party/ycmd/th
ird_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-
dir=/home/pel/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/clang/lib/cl
ang/11.0.0', '-limit-results=500']
-- Clangd logfiles:
-- /tmp/clangd_stderrwt8nh9g0.log
-- Clangd Server State: Initialized
-- Clangd Project Directory: /home/pel/sb/vim/src
-- Clangd Settings: {}
-- Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:33241
-- Server process ID: 484
-- Server logfiles:
-- /tmp/ycmd_33241_stdout_l350zqq4.log
-- /tmp/ycmd_33241_stderr_e0x3gran.log
Output of YcmDiags
No warnings or errors detected.
Output of git rev-parse HEAD
in YouCompleteMe installation directory
4496153a3efdb0891dac24510ac1ee519f1778a6
Contents of YCM, ycmd and completion engine logfiles
N/A
OS version, distribution, etc.
xubuntu-18.04.5 (up-to-date), Linux x86_64.
Output of build/install commands
N/A
Interesting, I can't repro in my version of vim, which is only a few patches behind yours.
(env) ben@BeniMac2020 10 % vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 6 2020 16:01:42)
macOS version
Included patches: 1-2100
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 +perl +title
-clientserver +job +persistent_undo -toolbar
+clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak +python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape +lua +ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval -mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -o vim -lm -lncurses -liconv -lintl -framework AppKit -L/usr/local/opt/lua/lib -llua5.4 -mmacosx-version-min=11.0 -fstack-protector-strong -L/usr/local/lib -L/usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level/CORE -lperl -L/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin -lpython3.9 -framework CoreFoundation -lruby.2.7
(env) ben@BeniMac2020 10 %
https://asciinema.org/a/3o7wDhqpOBGQp94mpVnMoEGi9
Also, macOS which does have some internal differences in vim.
The only think I can think of is that if YCM is making a blocking call in python-land, then it's "known" that ctrl-c doesn't interrupt that.
Do you get the behaviour with the ycm minimal vimrc (as noted in CONTRIBUTING.md ) ? vim -Nu /path/to/YCM/vimrc_ycm_minimal
I've known about this for a long time. I just thought this is how :sleep
worked. I can trivially repro this problem.
Do you get the behaviour with the ycm minimal vimrc (as noted in CONTRIBUTING.md ) ? vim -Nu /path/to/YCM/vimrc_ycm_minimal
Yes. Any other ideas?
I can't repro on linux at work either.... :/
Vim version at work? Feature differences?
![Screenshot 2020-12-10 at 18 25 05](https://user-images.githubusercontent.com/10584846/101813739-08079a00-3b15-11eb-8dfc-f0f28b1e76ce.png)
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 15 2020 19:21:07)
Included patches: 1-1989
Compiled by Arch Linux
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +cmdline_info -farsi +langmap +mouse_sgr +profile +tag_binary +virtualedit
+arabic +comments +file_in_path +libcall -mouse_sysmouse +python/dyn -tag_old_static +visual
+autocmd +conceal +find_in_path +linebreak +mouse_urxvt +python3/dyn -tag_any_white +visualextra
+autochdir +cryptv +float +lispindent +mouse_xterm +quickfix +tcl/dyn +viminfo
-autoservername +cscope +folding +listcmds +multi_byte +reltime +termguicolors +vreplace
+balloon_eval +cursorbind -footer +localmap +multi_lang +rightleft +terminal +wildignore
+balloon_eval_term +cursorshape +fork() +lua/dyn -mzscheme +ruby/dyn +terminfo +wildmenu
+browse +dialog_con_gui +gettext +menu +netbeans_intg +scrollbind +termresponse +windows
++builtin_terms +diff -hangul_input +mksession +num64 +signs +textobjects +writebackup
+byte_offset +digraphs +iconv +modify_fname +packages +smartindent +textprop +X11
+channel +dnd +insert_expand +mouse +path_extra +sound +timers -xfontset
+cindent -ebcdic +ipv6 +mouseshape +perl/dyn +spell +title +xim
+clientserver +emacs_tags +job +mouse_dec +persistent_undo +startuptime +toolbar -xpm
+clipboard +eval +jumplist +mouse_gpm +popupwin +statusline +user_commands +xsmp_interact
+cmdline_compl +ex_extra +keymap -mouse_jsbterm +postscript -sun_workshop +vartabs +xterm_clipboard
+cmdline_hist +extra_search +lambda +mouse_netterm +printer +syntax +vertsplit -xterm_save
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lelf -lcanberra -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
I see nothing relevant...
New info! I can't repro in a C++ file, but I can repro if I just start vim
- i.e. a buffer with no associated file, name or anything.
@puremourning asked:
Do you get the behaviour with the ycm minimal vimrc
Yes, I can reproduce it with:
$ cat ~/vimrc_ycm_minimal
call plug#begin()
Plug 'ycm-core/YouCompleteMe'
call plug#end()
$ vim -Nu ~/vimrc_ycm_minimal
Then enter :sleep 10
and CTRL-C does not interrupt it.
I see that @bstaletic indicated that he can reproduce it.
I just see that if I use /usr/bin/vim
which comes from Ubuntu packages (8.0.1453)
instead of the Vim that I built myself, then the bug does not happen.
Interesting, I will try to do a vim bisection to see if can find a change in Vim that
is causing this issue.
I do not have much free time (so be patient) but I'll post later here the result of the bisection.
Update: Doh! I was mistaken. My /usr/bin/vim
(8.0.1453) does not have Python
so YouCompleteMe did not do anything, which explain why the bug was not
reproduced with that version. Anyway, I can still spend time trying to build
older version of Vim to see if there is a regression in Vim.
Oh, this is interesting. If I load an extra conf I can interrupt sleep
. If I avoid loading any extra conf, I can't interrupt sleep.
This does conincide with what @dpelle posted in his debug info:
-- No extra configuration file found
Bug is at least not introduced by a recent patch of Vim, since at least vim-8.1.2269 (Nov 2019) has the same issue. I cannot try with an older version of Vim since YouCompleteMe then says:
YouCompleteMe unavailable: requires Vim 8.1.2269+.
@dpelle You can checkout commit 93956d747abd9f1ac438c219eb27e4ecd94cdb82
of YCM Which works on vim 7.4.
Using YCM 93956d747abd9f1ac438c219eb27e4ecd94cdb82, I check that the bug still happens with old versions of Vim.
I went up to Vim-7.4.1600 (March 2016) which has the same bug i.e. :sleep 10
not interrupted with CTRL-C.
I did not try older version, it's old enough to show that bug is not caused by a regression in Vim at least.
I also tried an old version version of YouCompleteMe in git 43ebd5252d7bb43849feb9f884044b051813039f (Jan 2018) and it also has the same bug. So it's also not a recent regression in YouCompleteMe.
No idea how I can help further.
Bug is at least not introduced by a recent patch of Vim, since at least vim-8.1.2269 (Nov 2019) has the same issue. I cannot try with an older version of Vim since YouCompleteMe then says:
YouCompleteMe unavailable: requires Vim 8.1.2269+.
aha,you can try Neovim,it has appimage,then you will not be trouble again
We'll need to get a stack trace of vim while the sleep is running and maybe set a breakpoint on got_int
internally.
We're not doing anything crazy in YCM but we do have python threads which are blocking in requests/urllib, so it could be some funky behaviour of vim interrupt handling (which is pervasive) and the embedded python.
There's certainly nothing in ycm that should block the UI thread from handling sigint.
Just a reminder:
Oh, this is interesting. If I load an extra conf I can interrupt sleep. If I avoid loading any extra conf, I can't interrupt sleep.
That makes zero sense, if you ask me.
I still can't reproduce this with or without an extra conf file on any version of vim or any OS!
I therefore don't see any hope of getting to a resolution to this heisenbug. I'm going to close the issue as unreproducible. Though, I feel kind of bad about it. I feel it's no worse than just doing nothing and leaving it open however. If we can get a solid reproducer and pinpoint ycm as the cause, then we can take another look. sorry about that.
@puremourning wrote:
I still can't reproduce this with or without an extra conf file on any version of vim or any OS!
For the record, I can still reproduce the bug with:
- vim-9.0.292 (latest at the time I write this).
- YouCompleteMe git tag c1a8a815e18af32288d01cc54e8caba0c2da1828 from Aug 27, 2022 (also latest)
This time, I'm using macOS-12.5.1 (M1). When I reported the bug in Dec 2020, I had a Linux x86_64 machine. So bug happens at least on macOS and Linux.
At least @bstaletic could reproduce it according to previous comments.
Anyway, if there is no clear way of fixing this, so be it.