abingham/emacs-ycmd

Symbols function definition is void: ycmd-running?

rennis250 opened this issue · 9 comments

It seems that the total install went successfully, but ycmd is not running, regardless? Here is the output of ycmd-show-debug-info:

(Note: the global_config.py is stolen from Spacemacs, but I was having the same problems without including it).

Ycmd debug information for buffer lib.rs in rust-mode:

((python
  (executable . "/usr/bin/python")
  (version . "2.7.14"))
 (completer
  (items
   ((value . "/home/rob/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/")
    (key . "Rust sources")))
  (name . "Rust")
  (servers
   ((executable . "/home/rob/ycmd/third_party/racerd/target/release/racerd")
    (extras)
    (name . "Racerd")
    (address . "127.0.0.1")
    (pid . 31755)
    (port . 39677)
    (is_running . t)
    (logfiles "/tmp/racerd_39677_stdout_z4HJRp.log" "/tmp/racerd_39677_stderr_w2jwcM.log"))))
 (extra_conf
  (path . "/home/rob/global_config.py")
  (is_loaded . t))
 (clang
  (has_support . t)
  (version . "clang version 4.0.1 (tags/RELEASE_401/final)")))


Server is running at: 127.0.0.1:40759

Ycmd Mode is enabled

--------------------

Ycmd version:   1.3snapshot (package: 20171111.854)
Emacs version:  25.3.1
System:         x86_64-redhat-linux-gnu
Window system:  x

Thanks and best,
Rob

ptrv commented

It would have helped if you post the backtrace of the error next time.

You have a mismatch of company-ycmd and ycmd versions.

I geuss the error comes from how package.el was installing ycmd and company-ycmd. The problem is that company-ycmd and ycmd were outdated and package.el updated company-ycmd before ycmd and byte-compiled it with the outdated function ycmd-runnung? function. So your version of byte-compiled company-ycmd.el has the wrong information.

Please try re-installing ycmd and company-ycmd. The problem should go away.

I'm a very new emacs user (basically 2 days now), so how do I get a backtrace of the error?

I uninstalled both ycmd and company-ycmd. I then reinstalled the latest version of ycmd from MELPA, restarted emacs, and reinstalled the latest version of company-ycmd from MELPA. I still get the same error.

Best,
Rob

I did a bit of reading. I set debug-on-error, debug-on-quit, and edebug-on-error all globally to true, but nothing shows up in the *Backtrace* buffer. I'm not sure how to do it correctly.

ptrv commented

I uninstalled both ycmd and company-ycmd. I then reinstalled the latest version of ycmd from MELPA, restarted emacs, and reinstalled the latest version of company-ycmd from MELPA. I still get the same error.

That's really strange. There is no occurrence of ycmd-running? in any ycmd code. Maybe you are loading another version or out-dated byte-compiled version of ycmd. Or some config is calling that function.

To find out we need the backtrace. To enable that you need to run the function toggle-debug-on-error instead of setting the variables to true.

It doesn't seem to generate any backtraces. It also seems like that error is gone? It was hard to see before, because I receive many messages of the form: HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1::36951/list_completions. These are appearing even though I set url-show-status to nil and request-message-level to -1. Anyway, I don't see the previous error in the *Messages* buffer. Just a mention sometimes of No completions found. Also, I am now noticing that the debug info reports that the ycmd server is listening on port 33811 , but the HTTPError above mentions port 36951, which is reported for racerd in the debug info. Perhaps the problem lies with racerd then...

Oh, wait, there is a *ycmd-server* buffer with more info:

2017-11-25 04:32:59,678 - INFO - Received completion request
2017-11-25 04:32:59,678 - DEBUG - Using filetype completion: True
2017-11-25 04:32:59,678 - INFO - RustCompleter._GetResponse
2017-11-25 04:32:59,679 - DEBUG - Making racerd request: b'POST' b'http://127.0.0.1:36951/list_completions' {u'x-racerd-hmac': 'fb2c7ce5b25f5e0a072b316215b273cf5044ba4ebae929fef85b8b5f80868f4a', u'content-type': u'application/json'} b'{"column": 16, "line": 63, "file_path": "/home/rob/my_docs/processing-rs/src/lib.rs", "buffers": [{"file_path": "/home/rob/my_docs/processing-rs/src/lib.rs", "contents": "***large amount of code***"}]}'
2017-11-25 04:32:59,680 - INFO - Starting new HTTP connection (1): 127.0.0.1
2017-11-25 04:32:59,687 - DEBUG - "POST /list_completions HTTP/1.1" 500 0
Traceback (most recent call last):
  File "/home/rob/my_docs/ycmd/third_party/bottle/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/home/rob/my_docs/ycmd/third_party/bottle/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 108, in wrapper
    return callback( *args, **kwargs )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/hmac_plugin.py", line 70, in wrapper
    body = callback( *args, **kwargs )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/handlers.py", line 103, in GetCompletions
    .ComputeCandidates( request_data ) )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/completers/completer.py", line 218, in ComputeCandidates
    candidates = self._GetCandidatesFromSubclass( request_data )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/completers/completer.py", line 231, in _GetCandidatesFromSubclass
    raw_completions = self.ComputeCandidatesInner( request_data )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/completers/rust/rust_completer.py", line 264, in ComputeCandidatesInner
    completions = self._FetchCompletions( request_data )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/completers/rust/rust_completer.py", line 282, in _FetchCompletions
    return self._GetResponse( '/list_completions', request_data )
  File "/home/rob/my_docs/ycmd/ycmd/../ycmd/completers/rust/rust_completer.py", line 198, in _GetResponse
    response.raise_for_status()
  File "/home/rob/my_docs/ycmd/third_party/requests/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:36951/list_completions
2017-11-25 04:41:50,773 - INFO - Received health request

...so, this could be something in ycmd and not any of the Emacs related code?

Yes, seems so: ycm-core/ycmd#849

Ok, was able to edit racerd and it all works now. :) However, there are now more fixes required to get it to work, aside from what is found in ycm-core/ycmd#849. I will document them in the relevant place for the Rust code.

ptrv commented

Ok, I guess the original issue is resolved for you and we can close the issue. It seems the server is running fine, except having issues with the rust subserver.