ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.46k stars 2.81k forks source link

Invoking (function) or (wrong function) through autocompletion using .(dot) operator leads to server crash #2298

Closed ehzawad closed 8 years ago

ehzawad commented 8 years ago

Only in Python

screenshoot

micbou commented 8 years ago

Please follow the instructions in CONTRIBUTING.md.

ehzawad commented 8 years ago

Ok.. fine .. at least, you have noticed the issue

micbou commented 8 years ago

Which issue? I am only seeing a screenshot where you tried to access to the JediHTTP server in a browser. Did you really expect this would work?

ehzawad commented 8 years ago

hell Actually, there is no error log.. just status shows error @micbou

micbou commented 8 years ago

Thanks. I can reproduce. I suspect this is a Jedi issue but reopening until I confirm it.

ehzawad commented 8 years ago

Actually, Autocompletion is working fine.. but sometimes autocomplete gives unknown error...I am not sure, Is there any server port mismatch .. from above image one is.. 47260 another is 40804.. I have no idea about jedi server..

micbou commented 8 years ago

It was indeed a Jedi issue and is fixed with this commit. We need to update our version of Jedi. I am keeping this issue open until we do. If you don't want to wait, you can update yourself Jedi by moving to the following folder:

YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi

and updating the Jedi repository to latest commit:

git pull origin master
vheon commented 8 years ago

Once https://github.com/vheon/JediHTTP/pull/22 is merged we can update the JediHTTP submodule directly.

ehzawad commented 8 years ago

@micbou Problem solved..But why, I have to manually update jedi.. Because I use vim-plug plugin manager. When plugin pull latest branch or commit.

vheon commented 8 years ago

@ehzShelter because jedi in the end is used as a submodule (actually is a submodule of JediHTTP which is a submodule of ycmd which is a submodule of YouCompleteMe) and as such is fixed to a commit hash. What vim-plug does is run git submodule update --init --recursive which will update also the submodule if one of the repo updates the submodule but it doesn't grab the latest release (and for good reasons).

ehzawad commented 8 years ago

Thank you for explanation @vheon

ehzawad commented 8 years ago

I thought.. The problem was solved..

Sometimes, It creates problem when I work with asyncio module in python3... async

I swear, should I need to install https://github.com/davidhalter/jedi ?? @vheon @micbou

ehzawad commented 8 years ago

Is there there any way to suppress autocomplete error via exception handling... dumping httpError using try ... catch() Mechanism? .. @vheon

vheon commented 8 years ago

I swear, should I need to install https://github.com/davidhalter/jedi ??

No yo don't have to install jedi we have JediHTTP as a submodule.

Is there there any way to suppress autocomplete error via exception handling... dumping httpError using try ... catch() Mechanism? .. @vheon

JediHTTP is an http+JSON wrapper for jedi and I thought of it as a really thin wrapper on top of jedi. So all it let you do is to use the jedi API but over http, and get the result as JSON. This means that if you used the jedi API directly and get a list of objects you will get an array of dictionary as JSON. When jedi would return an exception is caught a JSON dictionary with the data about the exception is returned.

This is what is happening:

So the question would not be "can the error not be displayed?" but rather "what is causing jedi to throw an exception?". To check the logs of JediHTTP just do :YcmDebugInfo and you will get where the logs are.

Sorry for the long explanation 😜

puremourning commented 8 years ago

TL;DR - we'd rather fix the error than suppress the error :)

On 27 August 2016 at 22:22, Andrea Cedraro notifications@github.com wrote:

I swear, should I need to install https://github.com/davidhalter/jedi ??

No yo don't have to install jedi we have JediHTTP as a submodule.

Is there there any way to suppress autocomplete error via exception handling... dumping httpError using try ... catch() Mechanism? .. @vheon https://github.com/vheon

JediHTTP https://github.com/vheon/JediHTTP is an http+JSON wrapper for jedi https://github.com/davidhalter/jedi and I thought of it as a really thin wrapper on top of jedi. So all it let you do is to use the jedi API but over http, and get the result as JSON. This means that if you used the jedi API directly and get a list of objects you will get an array of dictionary as JSON. When jedi would return an exception is caught a JSON dictionary with the data about the exception is returned.

This is what is happening:

  • you type write.
  • YCM sends to the JediHTTP a request with the buffer and the position
  • JediHTTP pass the request to jedi
  • jedi raise an exception
  • JediHTTP return the exception as the response
  • YCM see that is an exception and it displays it to the user.

So the question would not be "can the error not be displayed?" but rather "what is causing jedi to throw an exception?". To check the logs of JediHTTP just do :YcmDebugInfo and you will get where the logs are.

Sorry for the long explanation 😜

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Valloric/YouCompleteMe/issues/2298#issuecomment-242941589, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGDDuAzHnbIgMCV_PBqgqKMomSTlQuVks5qkKqQgaJpZM4JsFoH .

ehzawad commented 8 years ago

really good explanation @vheon ...! waiting for patch...!

vheon commented 8 years ago

really good explanation @vheon ...! waiting for patch...!

@ehzShelter for that we need a reproducible test case (does it happen only when working with async??) and the JediHTTP logs 👍

ehzawad commented 8 years ago

Yeah... @vheon When i want to use asyncio module ..

The code was from this page.. https://docs.python.org/3/whatsnew/3.5.html

import asyncio

async def http_get(domain): reader, writer = await asyncio.open_connection(domain, 80)

writer.write(b'\r\n'.join([
    b'GET / HTTP/1.1',
    b'Host: %b' % domain.encode('latin-1'),
    b'Connection: close',
    b'', b''
]))

async for line in reader:
    print('>>>', line)

writer.close()

loop = asyncio.get_event_loop() try: loop.run_until_complete(http_get('example.com')) finally: loop.close()

ehzawad commented 8 years ago

jediHttp_stderrLogfile

Traceback (most recent call last): File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 862, in _handle return route.call(_args) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 1732, in wrapper rv = callback(_a, _ka) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/hmac_plugin.py", line 58, in wrapper body = callback( args, _kwargs ) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/handlers.py", line 69, in completions } for completion in script.completions() ] File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/init.py", line 167, in completions completions = completion.completions() File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 89, in completions completion_names = self._get_context_completions() File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 161, in _get_context_completions completion_names += self._trailer_completions(atom_expr) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 197, in _trailer_completions scopes = self._evaluator.eval_element(atom_expr) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 262, in eval_element return self._eval_element_if_evaluated(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 275, in _eval_element_if_evaluated return self._eval_element_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 279, in _eval_element_cached return self._eval_element_not_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 286, in _eval_element_not_cached types = self._eval_atom(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 357, in _eval_atom return self.find_types(scope, atom, stmt.start_pos, search_global=True) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 142, in find_types return f.find(scopes, search_global) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 97, in find types = self._names_to_types(names, search_global) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 286, in _names_to_types new_types = _name_to_types(self._evaluator, name, self.scope) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 334, in _name_to_types types = _remove_statements(evaluator, typ, name) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 382, in _remove_statements types |= evaluator.eval_statement(stmt, seek_name=name) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 158, in eval_statement types = self.eval_element(rhs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 262, in eval_element return self._eval_element_if_evaluated(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 275, in _eval_element_if_evaluated return self._eval_element_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 279, in _eval_element_cached return self._eval_element_not_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 299, in _eval_element_not_cached types = self._eval_atom(element.children[0]) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 361, in _eval_atom c = atom.children AttributeError: 'Keyword' object has no attribute 'children' Traceback (most recent call last): File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 862, in _handle return route.call(_args) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/bottle/bottle.py", line 1732, in wrapper rv = callback(_a, _ka) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/hmac_plugin.py", line 58, in wrapper body = callback( args, _kwargs ) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/jedihttp/handlers.py", line 69, in completions } for completion in script.completions() ] File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/init.py", line 167, in completions completions = completion.completions() File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 89, in completions completion_names = self._get_context_completions() File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 161, in _get_context_completions completion_names += self._trailer_completions(atom_expr) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/api/completion.py", line 197, in _trailer_completions scopes = self._evaluator.eval_element(atom_expr) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 262, in eval_element return self._eval_element_if_evaluated(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 275, in _eval_element_if_evaluated return self._eval_element_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 279, in _eval_element_cached return self._eval_element_not_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 286, in _eval_element_not_cached types = self._eval_atom(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 357, in _eval_atom return self.find_types(scope, atom, stmt.start_pos, search_global=True) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 142, in find_types return f.find(scopes, search_global) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 97, in find types = self._names_to_types(names, search_global) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 286, in _names_to_types new_types = _name_to_types(self._evaluator, name, self.scope) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 334, in _name_to_types types = _remove_statements(evaluator, typ, name) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/finder.py", line 382, in _remove_statements types |= evaluator.eval_statement(stmt, seek_name=name) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 158, in eval_statement types = self.eval_element(rhs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 262, in eval_element return self._eval_element_if_evaluated(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 275, in _eval_element_if_evaluated return self._eval_element_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 279, in _eval_element_cached return self._eval_element_not_cached(element) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/debug.py", line 81, in wrapper return func(_args, _kwargs) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 299, in _eval_element_not_cached types = self._eval_atom(element.children[0]) File "/home/hell/.vim/plugged/YouCompleteMe/third_party/ycmd/third_party/JediHTTP/vendor/jedi/jedi/evaluate/init.py", line 361, in _eval_atom c = atom.children AttributeError: 'Keyword' object has no attribute 'children'

vheon commented 8 years ago

This is the ycmd log file. I need the JediHTTP log

ehzawad commented 8 years ago

jediHTTP log is upper comment thread

vheon commented 8 years ago

Oh yeah, sorry. Anyway as you can see the error in in jedi itself. Now if you already pulled the latest jedi version and you still get the error I think that you should report it upstream to the jedi devs.

ehzawad commented 8 years ago

OK..

micbou commented 8 years ago

Initial issue is fixed by PR #2370. Second issue is reported on the Jedi repository.