Skip to content
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

Extension causes high cpu load #3963

Closed
spopp opened this issue Jan 11, 2019 · 9 comments
Closed

Extension causes high cpu load #3963

spopp opened this issue Jan 11, 2019 · 9 comments
Assignees

Comments

@spopp
Copy link

spopp commented Jan 11, 2019

  • Issue Type: Performance
  • Extension Name: python
  • Extension Version: 2018.12.1
  • OS Version: Linux x64 4.10.0-38-generic
  • VSCode version: 1.30.2

Click on in imported class name - and drop on "Go to Definition" - on a definition it does not know about because I am opening a folder on a remote machine, and MS Code does not know how to find..

⚠️ Make sure to attach this file from your home-directory: /home/spopp/ms-python.python-unresponsive.cpuprofile.txt ⚠️
ms-python.python-unresponsive.cpuprofile.txt

Find more details here: https://github.com/Microsoft/vscode/wiki/Explain:-extension-causes-high-cpu-load

@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Jan 11, 2019
@d3r3kk d3r3kk added the triage label Jan 11, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Jan 11, 2019
@brettcannon brettcannon added the info-needed Issue requires more information from poster label Jan 15, 2019
@brettcannon
Copy link
Member

Is this with the language server or Jedi?

@spopp
Copy link
Author

spopp commented Jan 16, 2019

The python extension is ms-python.python - repository - https://github.com/Microsoft/vscode-python.
I do not know about language server or Jedi, but will investigate if you let me know how.

I'm running MS Code on a Linux machine and I was using a sftp connection to a remote server - and editing a file over that connection. I did not activate the python virtual environment on the remote machine before I started editing. That is the reason the IDE could not resolve all definitions. This would be the reason that "Go to Definition" should not have worked. It would be better if that task failed quickly with a Not Found message.

@gramster
Copy link
Member

gramster commented Feb 6, 2019

In the settings for the Python extension, is the "Jedi Enabled" checkbox set or cleared?

@spopp
Copy link
Author

spopp commented Feb 7, 2019

The "Jedi Enabled" checkbox is set

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Feb 14, 2019
@brettcannon
Copy link
Member

The profile says that it's stat calls which are taking about 40% of the time which is in line with mounting a remote file system.

@spopp when you say "[VS Code] does not know how to find", are you saying the module isn't available and so there's no chance to find it, or just that it's taking too long to find?

@brettcannon brettcannon added the info-needed Issue requires more information from poster label Feb 15, 2019
@spopp
Copy link
Author

spopp commented Mar 4, 2019

My apologies for replying so late. There is no chance of finding the code.

The remote machine has a code base that depends on pip installs into a virtual environment.
The remote application works because the virtual environment is activated before the application is run.

Steps:

    • install virtualenv
    • setup.sh:
#!/bin/bash

# create a project using a virtual environment
[[ -d .env ]] || virtualenv .env --python=python3 --no-site-packages

# Activate the virtual environment
export APPDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PYTHONPATH=$PYTHONPATH:$APPDIR
source $APPDIR/venv/bin/activate

# pip install into virtual environment (no sudo required)
# Where package xxxx does not exist on the current machine
# so can not be found outside the activated virtual environment
pip install xxxx

I sometimes attach to the remote file system using sftp, then use Visual Studio to edit (adding diagnostics code). The virtual environment will never be activated using sftp. There is no chance of finding the code - no chance that "Go to Definition" will work. It's not always obvious which definitions can be found (in the code) and which ones are in the virtual environment without digging deeper, so a quick response from "Go to Definition" would be useful - perhaps a user settable time limit.

@brettcannon
Copy link
Member

The extension expects the source to be available, so it not functioning as expected when the source isn't available isn't surprising. I think you want our remote editing scenario from #79.

@ghost ghost removed info-needed Issue requires more information from poster triage labels Mar 5, 2019
@spopp
Copy link
Author

spopp commented Mar 6, 2019 via email

@brettcannon
Copy link
Member

@spopp Yep, it's locked for the reasons you cited. My point is you can follow that issue if you want as that's how we plan to solve your problem.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants