syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.67k stars 4.89k forks source link

YCMD not working for python script #7179

Closed sixshotx closed 4 years ago

sixshotx commented 8 years ago

Description :octocat:

YCMD Auto-completion not working for python

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: Connection refused reported from ycmd-server

System Info :computer:

(helm spell-checking syntax-checking
      (auto-completion :variables auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior 'cycle auto-completion-complete-with-key-sequence nil auto-completion-complete-with-key-sequence-delay 0.1 auto-completion-enable-snippets-in-popup t auto-completion-private-snippets-directory nil)
      better-defaults
      semantic
      (ycmd :variables ycmd-server-command
            '("python" "/home/sixshotx/Repo/git/ycmd/ycmd/")
            ycmd-force-semantic-completion nil))
(with-eval-after-load 'python
    (add-hook 'python-mode-hook 'ycmd-mode)
    (setq python-shell-interpreter "python3"))

ycmd-server log :paw_prints:

2016-09-23 16:04:02,795 - DEBUG - Global extra conf not loaded or no function YcmCorePreload
serving on http://127.0.0.1:35797
2016-09-23 16:04:02,809 - INFO - Received ready request
2016-09-23 16:04:02,810 - INFO - Starting JediHTTP server
2016-09-23 16:04:02,810 - INFO - using port 33695
2016-09-23 16:04:02,813 - DEBUG - Making JediHTTP request: POST b'http://127.0.0.1:33695/ready' {'x-jedihttp-hmac': b'SPp3bQuF0Y04ABwByTHryT461+zVlQVXBrBqfJE9qr0=', 'content-type': 'application/json'} b''
2016-09-23 16:04:02,816 - INFO - Starting new HTTP connection (1): 127.0.0.1
2016-09-23 16:04:02,816 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=33695): Max retries exceeded with url: /ready (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff1902a9358>: Failed to establish a new connection: [Errno 111] Connection refused',))
Traceback (most recent call last):
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 137, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 91, in create_connection
    raise err
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/util/connection.py", line 81, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
    body=body, headers=headers)
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 353, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/usr/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 162, in connect
    conn = self._new_conn()
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connection.py", line 146, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.HTTPConnection object at 0x7ff1902a9358>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/connectionpool.py", line 609, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/packages/urllib3/util/retry.py", line 273, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=33695): Max retries exceeded with url: /ready (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff1902a9358>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sixshotx/Repo/git/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 105, in ServerIsHealthy
    return bool( self._GetResponse( '/ready' ) )
  File "/home/sixshotx/Repo/git/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 213, in _GetResponse
    headers = extra_headers )
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/sixshotx/Repo/git/ycmd/third_party/requests/requests/adapters.py", line 437, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=33695): Max retries exceeded with url: /ready (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7ff1902a9358>: Failed to establish a new connection: [Errno 111] Connection refused',))
2016-09-23 16:04:02,821 - INFO - Received event notification
2016-09-23 16:04:02,821 - DEBUG - Event name: BufferVisit
2016-09-23 16:04:02,822 - INFO - Received event notification
2016-09-23 16:04:02,822 - DEBUG - Event name: FileReadyToParse
2016-09-23 16:04:02,822 - INFO - Adding buffer identifiers for file: /home/sixshotx/tmp/python/x.py
2016-09-23 16:04:04,855 - INFO - Received event notification
2016-09-23 16:04:04,855 - DEBUG - Event name: FileReadyToParse
2016-09-23 16:04:04,855 - INFO - Adding buffer identifiers for file: /home/sixshotx/tmp/python/x.py
2016-09-23 16:04:16,839 - INFO - Received event notification
2016-09-23 16:04:16,839 - DEBUG - Event name: FileReadyToParse
2016-09-23 16:04:16,839 - INFO - Adding buffer identifiers for file: /home/sixshotx/tmp/python/x.py
TheBB commented 8 years ago

I see the same, but the error message indicates that ycmd can't connect to jedi. Did you report to ycmd?

sixshotx commented 8 years ago

Not yet. I think the problem might be within either spacemacs or emacs-ycmd. I have no problem connecting jedi using vim-youcompleteme with the same ycmd engine though.

TheBB commented 8 years ago

Then did you try reproducing with just emacs-ycmd?

deb0ch commented 8 years ago

emacs-ycmd is a bit outdated sometimes, so it is possible that it is coming from there.

The example I am refering to is if you try to call ycmd-restart-semantic-server you get a "usage" error message, saying that the command is not supported:

REQUEST [error] Error (error) while connecting to http://127.0.0.1:44286/run_completer_command.
Supported commands are:
ClearCompilationFlagCache
FixIt
GetDoc
GetDocQuick
GetParent
GetType
GoTo
GoToDeclaration
GoToDefinition
GoToImprecise
GoToInclude
See the docs for information on what they do.
github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!