Skip to content

Intellisense tooltip not show #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MrMYHuang opened this issue Feb 18, 2018 · 17 comments
Closed

Intellisense tooltip not show #817

MrMYHuang opened this issue Feb 18, 2018 · 17 comments
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug

Comments

@MrMYHuang
Copy link

MrMYHuang commented Feb 18, 2018

Environment data

VS Code version: 1.20.1
Python Extension version: 2018.1.0
Python Version: 2.7.5
OS and version: CentOS 7.4.1708
caffe2 (with GPU enabled) commit: 5651c4ce0279c895cbb1d1eeecc6594cc8791103

Actual behavior

Intellisense tooltip is not shown.

Expected behavior

Intellisense tooltip is shown.

Steps to reproduce:

  • git clone https://github.com/facebookresearch/Detectron.git
  • cd Detectron/tools
  • code infer_simple.py
  • Scroll to the 144-th line.
  • Move mouse cursor over the text GlobalInit, and you will see a tooltip (Intellisense) shows Loading...
  • Move mouse cursor to other texts and you will find Intellisense tooltip doesn't show anymore.

Logs

Output from Console window (Help->Developer Tools menu)

[Extension Host] Python Extension: sendCommand jediProxy, Error (sendCommand) This socket has been ended by the other party null
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253
t._logExtensionHostMessage @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2713
(anonymous) @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2709
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253
[Extension Host] Error: This socket has been ended by the other party
	at Socket.writeAfterFIN [as write] (net.js:305:12)
	at JediProxy.<anonymous> (/home2/grad97/myh/.vscode/extensions/ms-python.python-2018.1.0/out/client/providers/jediProxy.js:175:33)
	at Generator.next (<anonymous>)
	at fulfilled (/home2/grad97/myh/.vscode/extensions/ms-python.python-2018.1.0/out/client/providers/jediProxy.js:12:58)
	at <anonymous>
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253
t._logExtensionHostMessage @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2713
(anonymous) @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:2709
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:253
@MrMYHuang MrMYHuang changed the title Intellisense tooltip not shown Intellisense tooltip not show Feb 18, 2018
@MikhailArkhipov MikhailArkhipov added awaiting 1-verification area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. labels Feb 19, 2018
@MikhailArkhipov
Copy link

Most probably #263

@MrMYHuang
Copy link
Author

It's not related to RAM consumption. I can reproduce this bug when VScode consumes only 200 MB RAM.

@MikhailArkhipov
Copy link

Its not vscode but rather python.exe running completion.py.
This socket has been ended by the other party looks like completion process crashed.

@MrMYHuang
Copy link
Author

I did see a python2 process appeared when I used Intellisense tooltip in VScode. But when I reproduced the bug (move mouse cursor to GlobalInit), the python2 process disappeared (crash!?). During the test, the KDE System Load Viewer showed the python2 process consumed < 70 MB RAM...

@MrMYHuang
Copy link
Author

MrMYHuang commented Feb 20, 2018

This bug seems to be unrelated to Detectron but caffe2.python. caffe2 is a C/C++ libraries/tools with python wrappers. I checked the definition of workspace.GlobalInit from /usr/caffe2/python/workspace.py. workspace.py shows:

...
import caffe2.python._import_c_extension as C
...
GlobalInit = C.global_init
HasBlob = C.has_blob
...

It seems GlobalInit is a Python interface to a C/C++ function global_init.
Actually, I create a line workspace.HasBlob in "infer_simple.py" and open it by vscode..., I can also reproduce the python2 crash bug.

@MrMYHuang
Copy link
Author

I am debugging vscode-python. I achieve a line which causes the external python process crash in jediProxy.ts:
this.proc.stdin.write(`${JSON.stringify(payload)}\n`);
Unfortunately, I don't know how to use debugger to attach to the external python process started by jediProxy to get more crash info...

@MrMYHuang
Copy link
Author

I find a workaround by restarting the external python process. See #826.
I don't know there is a better solution for this problem...

@MrMYHuang
Copy link
Author

MrMYHuang commented Feb 20, 2018

I successfully debug completion.py by pydevd. Steps:

  • sudo pip2 install pydevd
  • Add import pydevd;pydevd.settrace() after if __name__ == '__main__': in vscode-python/pythonFiles/completion.py.
  • Debug vscode-python extension by VS Code.
  • Move mouse cursor to a .py file with workspace.GlobalInit to trigger python2 completion.py preview external process.
  • Open Eclipse with PyDev.
  • Open Debug perspective
  • Menu/Pydev/Attach to Process/attach to the external python2 process.

Finally, I find completion.py imports both caffe2.python.caffe2_pybind11_state_gpu and caffe2.python.caffe2_pybind11_state. Actually, either one (not both) of those modules is imported in the caffe2.python._import_c_extension Python source code, but I don't know why completion.py imports both and then crashes the external Python process.
Finally, I find codes to reproduce the Python crash directly in terminal:

[myh@dsrl2 detectron]$ python2
Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from caffe2.python.caffe2_pybind11_state import *
>>> from caffe2.python.caffe2_pybind11_state_gpu import *
Key already registered.
Offending key: Python.
(crash)
[myh@dsrl2 detectron]$ 

@MikhailArkhipov
Copy link

Interesting. Thanks for digging :-)

@MikhailArkhipov MikhailArkhipov added bug Issue identified by VS Code Team member as probable bug awaiting 2-PR and removed awaiting 1-verification labels Feb 20, 2018
@MikhailArkhipov
Copy link

@DonJayamanne , what's your take

@patrys
Copy link

patrys commented Feb 20, 2018

I think it should be blacklisted by Jedi. The _import_c_extension.py module essentially does:

try:
    import fist_compiled_implementation
except ImportError:
    import other_compiled_implementation

It looks like since Jedi is unable to determine which one is going to be loaded it tries to load both.

@DonJayamanne
Copy link

DonJayamanne commented Feb 20, 2018

Its highly likely a jedi issue. We're not importing anything manually. I don't believe Jedi imports either. I always assumed it performed static analysis.
I'll file an issue on Jedi after I've verified it is a Jedi issue.

@patrys
Copy link

patrys commented Feb 20, 2018

@DonJayamanne
Copy link

DonJayamanne commented Feb 20, 2018

These are C modules so I believe Jedi does try to import them:

Ah yes, thats correct.
Will be closing this as an upstream issue.

@MrMYHuang
Please report the issue on Jedi

@balta2ar
Copy link

@DonJayamanne Sorry for the off-topic but vscode-python team seems to be working hard on adding PTVS support for debugging, right? Does that mean that it will also be used for IntelliSense (code completion) and jedi will be dropped some day?

@smortaz
Copy link

smortaz commented Feb 20, 2018

@balta2ar - yes, both the debugger and intellisense will be seeing improvements. Since they're fundamental to just about any scenario, they're a high priority for the next few months.

@MrMYHuang
Copy link
Author

Thank for everyone. I report this issue to jedi.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

6 participants