Youcompleteme: ycmd server always shutting down

Created on 5 Jun 2016  ·  31Comments  ·  Source: ycm-core/YouCompleteMe

Hi, I'm on my Macbook Air OS X El Capitan (10.11.5) and I couldn't make YCM to work yet. What I did so far:
a) Installed YCM following the instructions with Vundle
b) Opened a python existing code in vim to check if there's some autocompletion. I don't see anything. Vim just acts like nothing is installed.
c) I type "messages" and everything looks normal:

Messages maintainer: Bram Moolenaar [email protected]
"~/repo/ratts/automation/eg/egDb.py" 146L, 4698C
Press ENTER or type command to continue

d) As soon as I try to insert some text, the following message appears:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Run ':YcmToggleLogs stderr' to check the logs.

e) I checked the log files server_60372_stderr.log and server_60372_stdout.log and they are empty, so, no clue of what is going on here.
f) I tried to remove all the ~/.vim* and restart the process. Same result.
g) I tried to go to the YCM folder "cd ~/.vim/bundle/YouCompleteMe" and use "./install.py". Same result.
h) Note: I have Python3 installed using brew, but looks like is not affecting anything.

I'm running out of ideas and any help is very welcomed. Thanks.

debugInfo.txt
vimversion.txt
vimrc.txt

Most helpful comment

I'm using Anaconda, and I had this problem on multiple machines. When trying to import ycm_core, it failed and the error message is glibcxx_3.4.20' not found. The way I solve it is by installing (upgrading) libgcc in conda:

conda install libgcc

All 31 comments

Please don't delete the issue template, just fill it out. As per CONTRIBUTING.md could you set

let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'

in your vimrc, make ycmd crash again and then do :YcmToggleLogs stderr?

Hello Vheon, thank you so much and sorry for now following the correct instructions before posting this. After changing what you said, it appears a new message talking about "no global extra conf"(stderr file):
2016-06-05 17:35:52,472 - DEBUG - No global extra conf, not calling method YcmCorePreload

I was researching here and I thought that it was something related to .ycm_extra_conf.py, but looks like this is related just to c/c++ files (I'm using python) and is not required. I even created this file but nothing changed. Do you have some suggestion?

debug:
Printing YouCompleteMe debug information...
-- Server crashed, no debug info from server
-- Server running at: http://127.0.0.1:61965
-- Server process ID: 97440
-- Server logfiles:
-- /var/folders/48/lr4d09sd40gg7p7k2lfzwlc00000gn/T/ycm_temp/server_61965_stdout.log
-- /var/folders/48/lr4d09sd40gg7p7k2lfzwlc00000gn/T/ycm_temp/server_61965_stderr.log
PS: server_61965_stdout.log is empty and server_61965_stderr.log just has the message that I posted above.

So it didn't crash...

Looks like not... But it should show some other message no? Is there some other log message hidden somewhere?

Now I installed in my other macbook and still can't make it work, but the error changed.

ValueError: No semantic completer exists for filetypes: [u'']

I've seen other people having a similar error, but in their case the file extension appears in the message, what is not my case. I created a test.py file, put "import math" and after I typed "math." but nothing happened. This is my log:

completer = _GetCompleterForRequestData( request_data )
File "/Users/arthurfaccioly/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 253, in _GetCompleterForRequestData
return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] )
File "/Users/arthurfaccioly/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/server_state.py", line 89, in GetFiletypeCompleter
current_filetypes ) )
ValueError: No semantic completer exists for filetypes: [u'']

debug output:

Printing YouCompleteMe debug information...
-- Server has Clang support compiled in: False
-- Server running at: http://127.0.0.1:50602
-- Server process ID: 34198
-- Server logfiles:
-- /var/folders/xg/pyzz5d_94q36zn2cvpn79l540000gn/T/ycm_temp/server_50602_stdout.log
-- /var/folders/xg/pyzz5d_94q36zn2cvpn79l540000gn/T/ycm_temp/server_50602_stderr.log

Thank you again for your help, I know that you probably has a lot of cases to check.

Looks like not... But it should show some other message no? Is there some other log message hidden somewhere?

I still don't understand if you're looking for a message saying that is working or a message saying that is not :confused: So what happen if you open a python file and start typing?

ValueError: No semantic completer exists for filetypes: [u'']

this means that you don't have a filetype setted for the buffer you're working in.

Hello Vheon,

I'm looking for any message that explains to me what I did wrong. :-) Looks like now I'm getting close.

  1. I removed my .profile because the PATH was messed with the one from my .bash_profile.
  2. "brew unlink python" and "brew link python"
  3. Added "filetype on" to .vimrc
  4. vim test.py
    import math
    math. (ctrl+space)
    and worked! (print attached)
  5. So now I typed "messages" and guess what. The same message appears:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Run ':YcmToggleLogs stderr' to check the logs.

Now I'm trying to figure out what happened. The logs are still just with the message that I reported before.

I'm attaching my .vimrc and .bash_profile. Can you take a look to see if I'm messing with some configuration? Thank you a lot!

bash_profile.txt
vimrc.txt
screen shot 2016-06-06 at 10 09 37 am

After updating my gentoo system recently i noticed a similar behaviour. Turned out that vim or ycm tried to use python3 instead of python2 to run ycmd despite vim being compiled with python2 support only.
There seems to be a recent change in app-vim/gentoo-syntax package which introduced a new function GentooGetPythonTargets(). Maybe this is related.

TL;DR; Fixed my ycm installation by adding let g:ycm_server_python_interpreter = 'python2' to my vimrc.

@arthurfaccioly Go to the YouCompleteMe/third_party/ycmd folder and start the Python interpreter then run the command:

import ycm_core

If nothing happen, Python is successfully importing the YCM library and you have another issue. Otherwise, paste the error here.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (PyInit_ycm_core)

That's what I get when I import using python3. python2 works just fine however

There is a README entry about this.

Hitting the exact same issue on Mac OSX El Capitan (10.11.6). I assume @puremourning is referring to this section of the README:

It appears that YCM is not working

In Vim, run :messages and carefully read the output. YCM will echo messages to the message log if it encounters problems. It's likely you misconfigured something and YCM is complaining about it.

Also, you may want to run the :YcmDebugInfo command; it will make YCM spew out various debugging information, including the ycmd logfile paths and the compile flags for the current file if the file is a C-family language file and you have compiled in Clang support. Logfiles can be automatically opened in the editor using the :YcmToggleLogs command.

Sadly this doesn't lead to much of any info.

Printing YouCompleteMe debug information...
-- Server crashed, no debug info from server
-- Server running at: http://127.0.0.1:62230
-- Server process ID: 21687
-- Server logfiles:
-- /var/folders/zv/65r2y75x3zj6t7yfk8n5t8q00000gp/T/ycm_temp/server_62230_stdout.log

Logs only contain:
2016-08-29 16:26:34,813 - DEBUG - No global extra conf, not calling method YcmCorePreload

let g:ycm_server_python_interpreter = 'python2'

Doesn't fix it.

I get the same error as @SethDusek when importing the ycm_core under Python3, though Python2 works.

Maybe I'm missing something in the README. Anyone have a suggestion on next steps?

@JamesMcMahon What is the output of the command:

python third_party/ycmd/ycmd

in the YouCompleteMe folder (python being the Python 2 interpreter)?

@micbou

⋊> ~/.v/b/YouCompleteMe on master ◦ python third_party/ycmd/ycmd 16:38:30
usage: ycmd [-h] [--host HOST] [--port PORT] [--log LOG]
[--idle_suicide_seconds IDLE_SUICIDE_SECONDS]
[--check_interval_seconds CHECK_INTERVAL_SECONDS] --options_file
OPTIONS_FILE [--stdout STDOUT] [--stderr STDERR] [--keep_logfiles]
ycmd: error: argument --options_file is required

Python3:

⋊> ~/.v/b/YouCompleteMe on master ◦ python3 third_party/ycmd/ycmd 16:38:31
usage: ycmd [-h] [--host HOST] [--port PORT] [--log LOG]
[--idle_suicide_seconds IDLE_SUICIDE_SECONDS]
[--check_interval_seconds CHECK_INTERVAL_SECONDS] --options_file
OPTIONS_FILE [--stdout STDOUT] [--stderr STDERR] [--keep_logfiles]
ycmd: error: argument --options_file is required

That's the expected error. So, ycmd is able to load the Python modules and the ycm_core library on Python 2. Are you sure the stderr logfile is empty? Even with the following options:

let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'

in your vimrc?

Yup, just double checked to make sure. So even with those lines in my .vimrc. The stdout log file is completely empty and stderr contains just this line:

2016-08-29 16:51:02,939 - DEBUG - No global extra conf, not calling method YcmCorePreload

Start again Vim and wait for the ycmd server to shut down, then run the following command:

:py print(ycm_state._server_popen.stderr.read())

and paste its output (use :messages to see it).

Getting Fatal Python error: PyThreadState_Get: no current thread

There is an entry about this error in the FAQ. Are you on OS X?

Ah, didn't link that error to the README because I didn't see it until I ran the :py print(ycm_state._server_popen.stderr.read()) command. Thanks for your help, now I just need need to figure out how to --enable-framework under Homebrew. Is there a recommendation for that?

Also post reinstalling a framework enabled version of Python do I need to recompile YCM or should it just work?

Is there a recommendation for that?

brew install python --framework should be enough.

Also post reinstalling a framework enabled version of Python do I need to recompile YCM or should it just work?

I think you need to recompile YCM.

So I actually had another issues were the MacVim I installed from the site wasn't using the Homebrew Python, so I did the following:

  1. Switched MacVim over the Homebrew version of MacVim and got it on the correct Homebrew Python.
  2. I reran the make config and compile in the YCM directory.

Still have the exact same issue 😦

EDIT: Backed up a bit and deleted the plugin and reinstalled from Vundle and reinstalled from scratch. It appears to be working now. Thanks for the help @micbou.

Hopeful me working through this issue is helpful to people who find this thread on Google.

I'm using Anaconda, and I had this problem on multiple machines. When trying to import ycm_core, it failed and the error message is glibcxx_3.4.20' not found. The way I solve it is by installing (upgrading) libgcc in conda:

conda install libgcc

@jinjiren I encountered the same problem. Your method really helped me! Thanks!

@JamesMcMahon I have installed macvim with homebrew and followed the YCM setup but the YCM server error persists. How can I be sure that I am using the homebrew python you are referring to? Recently switched over to macvim from linux vim and I want my favourite plugin back in my life!

Sorry, it's been too long.

I actually uninstalled You Complete Me because it broke all the time and my focus has been on other editors.

I'd double check the verision of python that MacVim is compiled with and make sure it matches your system python version. I'd also recompile the plugin once you have everything settled.

@JamesMcMahon Thank you for your response. I seemed to have solved the issue. I think I avoided pyhton issues by building with the.sh script. For anyone still encountering problems have a look here:

http://www.nyayapati.com/srao/2014/12/installing-homebrew-macvim-with-youcompleteme-on-yosemite/

i got some error like you ,and it's ok when input following command
./install.sh --clang-completer --system-libclang
so maybe,you can also fix it.

:py print(ycm_state._server_popen.stderr.read())

Nothing happend, but still The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code -11. Type... only.
I also tried reinstall YCM and ./install.sh --clang-completer --system-libclang still didn't work.

MacOS10.14 with macvim8.1

I glanced at the update instructions and updated the installation script 9 months ago. I had this problem about a year ago. So it may not work

------------------ 原始邮件 ------------------
发件人: "NorthFun"<[email protected]>;
发送时间: 2019年12月22日(星期天) 下午3:18
收件人: "ycm-core/YouCompleteMe"<[email protected]>;
抄送: "kkkkkkkkkkkkkkkkkkkkkkkk"<[email protected]>;"Comment"<[email protected]>;
主题: Re: [ycm-core/YouCompleteMe] ycmd server always shutting down (#2197)

:YcmToggleLogs stderr

Hi, seems the same problem, but I tried this cmd and didn't see any output, what should I do?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

I can't remember exactly. I remember I reinstalled it in June, and the process was very smooth. Did you forget to introduce the parameters file:.ycm_extra_conf.py

------------------ 原始邮件 ------------------
发件人: "NorthFun"<[email protected]>;
发送时间: 2019年12月22日(星期天) 下午3:24
收件人: "ycm-core/YouCompleteMe"<[email protected]>;
抄送: "kkkkkkkkkkkkkkkkkkkkkkkk"<[email protected]>;"Comment"<[email protected]>;
主题: Re: [ycm-core/YouCompleteMe] ycmd server always shutting down (#2197)

:py print(ycm_state._server_popen.stderr.read())

Nothing happend, but still The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code -11. Type... only.
I also tried reinstall YCM and ./install.sh --clang-completer --system-libclang still didn't work.

MacOS10.14 with macvim8.1


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

Was this page helpful?
0 / 5 - 0 ratings