YouCompleteMe icon indicating copy to clipboard operation
YouCompleteMe copied to clipboard

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1.

Open mark-i-m opened this issue 9 years ago • 20 comments

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.
  • [x] 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.
  • [x] If filing a bug report, I have included a minimal test case that reproduces my issue, including what I expected to happen and what actually happened.
  • [x] If filing a installation failure report, I have included the entire output of install.py (or cmake/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

Provide a clear description of the problem, including the following key questions:

  • What did you do?

Include steps to reproduce here.

  1. Do a fresh install of YCM on my system via Vundle, as per the README. ./install.py completes with no errors. I used --clang-completer and --rust-completer. This completed without errors.

  2. Open a C or Rust file in Vim.

  3. Almost immediately, I get the following message:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1. Type ':YcmToggleLogs ycmd_41096_stderr_g94lju2q.log' to check the logs.

Include description of a minimal test case, including any actual code required to reproduce the issue.

Open any C or Rust file (I have tried a few)...

  • What did you expect to happen?

I expected to see no error messages and be able to get completions.

  • What actually happened?

I got the error message posted above pretty much immediately after starting vim, with no user interaction required to cause it.

Diagnostic data

Output of vim --version

$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
+balloon_eval    +float           +mouse_urxvt     +tcl
+browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
+clientserver    +iconv           +packages        +toolbar
+clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             +perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xsmp_interact
+emacs_tags      +mouseshape      +startuptime     +xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    +xpm
+extra_search    -mouse_jsbterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -D_REENTRANT -DORBIT2=1 -pthread -I/usr/include/libgnomeui-2.0 -I/usr/include/gnome-keyring-1 -I/usr/include/libbonoboui-2.0 -I/usr/include/libxml2 -I/usr/include/libgnome-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/orbit-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gail-1.0 -I/usr/include/libart-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/x86_64-linux-gnu/gnome-vfs-2.0/include -I/usr/include/gconf/2 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype  -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lgnomecanvas-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lfreetype -lgdk_pixbuf-2.0 -lgnomevfs-2 -lgconf-2 -lgthread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_54c3rwsi.log
-- Server errored, no debug info from server
-- Server running at: http://127.0.0.1:53422
-- Server process ID: 15807
-- Server logfiles:
--   /tmp/ycmd_53422_stdout_chlbwoa2.log
--   /tmp/ycmd_53422_stderr_t9zsfggd.log

Contents of YCM, ycmd and completion engine logfiles

Gist: here

ycmd_53422_stdout_chlbwoa2.log and ycmd_53422_stderr_t9zsfggd.log are completely empty (size = 0B).

OS version, distribution, etc.

Ubuntu 16.04

Linux seclab8 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Output of build/install commands

Include link to a gist containing the invocation and entire output of install.py if reporting an installation issue.

I didn't have any issues with building/installing, so I didn't save the output. But I can rerun ./install.py and post the output if you want...

mark-i-m avatar Nov 22 '17 19:11 mark-i-m

Thanks for the report. If the ycmd logfiles are empties, this means that the server crashed before redirecting its standard streams to the logfiles. You should try to start ycmd manually. Run these commands in a terminal:

cd ~/.vim/bundle/YouCompleteMe/third/ycmd
cp ycmd/default_settings.json .
python ycmd --options_file default_settings.json

and paste the output.

micbou avatar Nov 22 '17 20:11 micbou

$ python ycmd --options_file default_settings.json
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/__main__.py", line 44, in <module>
    from ycmd.hmac_plugin import HmacPlugin
  File "xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 26, in <module>
    import requests
  File "xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "xxx/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests/requests/packages/urllib3/contrib/pyopenssl.py", line 54, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

mark-i-m avatar Nov 22 '17 20:11 mark-i-m

@micbou Thanks for your response... Is there some dependency on a particular version of OpenSSL?

mark-i-m avatar Nov 22 '17 20:11 mark-i-m

Seems related to issue https://github.com/Valloric/YouCompleteMe/issues/2765. Could you try the suggestion in that comment?

sudo apt purge python-openssl
sudo apt install python-openssl

micbou avatar Nov 22 '17 20:11 micbou

Hey! That worked 🎉

Thanks @micbou!

mark-i-m avatar Nov 22 '17 20:11 mark-i-m

Happy to help.

micbou avatar Nov 22 '17 20:11 micbou

@mark-i-m in this same situation i am getting can't find 'main' module in 'ycmd'

DShivansh avatar Mar 12 '18 06:03 DShivansh

please help

DShivansh avatar Mar 12 '18 06:03 DShivansh

@DShivansh please see CONTRIBUTING.md

puremourning avatar Mar 12 '18 10:03 puremourning

@DShivansh I wish I could help, but I am not really that familiar with the internals of YCM... I just followed the suggestion in the post above.

mark-i-m avatar Mar 12 '18 22:03 mark-i-m

can't find 'main' module in 'ycmd' in this same situation i am getting

No, they are totally different and unrelated. @DShivansh make sure that you have run git submodule update --init --recursive and that you're using python 2.7.2 or later (or python 3.4.0 or later)

puremourning avatar Mar 12 '18 22:03 puremourning

worked for me: Just run /usr/bin/python install.py in ~/.vim/plugged/YouCompleteMe

kirykr avatar Jun 07 '18 13:06 kirykr

I've spent one hour trying to resolve and finally found it. Thanks kirykr

idopshik avatar Sep 08 '18 09:09 idopshik

For me the an issue looking like the original issue (on opening rust file) was due to having a corrupt PYTHONPATH set. After unsetting it I could run the ycmd without issue!

rednatto avatar Dec 05 '18 23:12 rednatto

in this same situation , i find in third_party/waitress/waitress/server.py at line 206,then function self.socketmod.gethostbyaddr(server_name)[0] is run error if your computer name contains Chinese characters

yanchina avatar Mar 04 '19 08:03 yanchina

had anaconda installed and using python3 install.py worked for me

Peppershaker avatar Mar 24 '19 06:03 Peppershaker

$ cd ~/.vim/bundle/YouComepleteMe
$ /usr/bin/python install.py

hohumsup avatar Apr 01 '19 21:04 hohumsup

For me the an issue looking like the original issue (on opening rust file) was due to having a corrupt PYTHONPATH set. After unsetting it I could run the ycmd without issue!

Could you please elaborate on how to set PYTHONPATH for ycmd to work? I had no problem with using python elsewhere but not able to get away with the server shut down error with YCM

alicelyy avatar May 24 '19 19:05 alicelyy

I also ran into this issue. To fix it I had to:

$ sudo apt install cmake
$ cd ~/.vim/bundle/YouComepleteMe
$ python3 install.py

derekwilling avatar Jun 02 '20 02:06 derekwilling

https://github.com/ycm-core/YouCompleteMe/wiki/Troubleshooting-steps-for-ycmd-server-SHUT-DOWN

puremourning avatar Jun 02 '20 07:06 puremourning