Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Stuck at analyzing in background and causing high cpu load #1291

Description

@kaushall

Environment data

  • VS Code version: 1.36.0 (Stable Channel)
  • Extension version (ms-python.python): 2019.6.22090
  • OS and version: Ubuntu 18.04 LTS
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7.15
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv

============================================================

Logs

User belongs to experiment group 'AlwaysDisplayTestExplorer - control'
Starting Microsoft Python language server.
[Info - 10:33:32 AM] Analysis cache path: /home/kaushal/.cache/Microsoft/Python Language Server
[Info - 10:33:32 AM] GetCurrentSearchPaths /home/kaushal/microfinance/venv/bin/python
[Info - 10:33:33 AM] Interpreter search paths:
[Info - 10:33:33 AM] /home/kaushal/microfinance/venv/lib/python2.7
[Info - 10:33:33 AM] /home/kaushal/microfinance/venv/lib/python2.7/lib-dynload
[Info - 10:33:33 AM] /usr/lib/python2.7
[Info - 10:33:33 AM] /usr/lib/python2.7/plat-x86_64-linux-gnu
[Info - 10:33:33 AM] /usr/lib/python2.7/lib-tk
[Info - 10:33:33 AM] /home/kaushal/microfinance/venv/local/lib/python2.7/site-packages
[Info - 10:33:33 AM] /home/kaushal/microfinance/venv/lib/python2.7/site-packages
[Info - 10:33:33 AM] User search paths:
[Info - 10:33:35 AM] Microsoft Python Language Server version 0.3.21.0
[Info - 10:33:35 AM] Initializing for /home/kaushal/microfinance/venv/bin/python
.
.
.
Analysis of pandas.core.dtypes.dtypes(Library) completed in 5.9831 ms.
Analysis of pandas.core.dtypes.api(Library) completed in 0.7383 ms.
Analysis of pandas.io.json.table_schema(Library) completed in 1.6775 ms.
Analysis of pandas.core.indexing(Library) completed in 32.862 ms.
Analysis of pandas.util.testing(Library) completed in 49.5013 ms.
Analysis of pandas.core.sorting(Library) completed in 12.6855 ms.
Analysis of pandas.plotting._misc(Library) completed in 12.8782 ms.
Analysis of pandas.testing(Library) completed in 0.1046 ms.
Analysis of pandas.core.algorithms(Library) completed in 34.2249 ms.
Analysis of pandas.core.base(Library) completed in 21.2535 ms.
Analysis of pandas.core.missing(Library) completed in 21.3684 ms.
Analysis of pandas.core.util.hashing(Library) completed in 6.393 ms.
Analysis of pandas.core.indexes.frozen(Library) completed in 5.9272 ms.
Analysis of pandas.io.formats.format(Library) completed in 63.51 ms.
Analysis of pandas.core.internals(Library) completed in 101.1854 ms.

Screenshot

Screenshot from 2019-07-09 10-53-17

Activity

  1. raaaaaymond commented on Jul 9, 2019

    @raaaaaymond

    Yep. I was having the same problem before. It was resolved for a while by some updates, and now I'm having the same problem again immediately after updating to 1.36. My environment is:

    VSCode 1.36.0
    Server version 0.3.20.0
    Python extension version 2019.6.22090
    MacOS 10.14.5
    Python 3.7.2 (via Pyenv, no virtual environment)

  2. jakebailey commented on Jul 9, 2019

    @jakebailey
    Member

    I'm not sure this could be related to any VS Code update; the same version of the language server would be downloaded by any version of VS Code (currently 0.3.20). This is likely something else.

  3. jakebailey commented on Jul 9, 2019

    @jakebailey
    Member

    We just built 0.3.22, which is available in the beta/daily channels. It contains some fixes which we believe will help solve some of the leaks. You can set this and reload to update:

    "python.analysis.downloadChannel": "beta"
    
  4. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    Jake Bailey (@jakebailey)

    I'm still facing this issue.

    Screenshot from 2019-07-10 10-45-25

    Current extension version (ms-python.python): 2019.6.24221

  5. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    Here is the version of language server,

    [Info - 10:39:46 AM] Microsoft Python Language Server version 0.3.22.0
    [Info - 10:39:46 AM] Initializing for /home/kaushal/microfinance/venv/bin/python

  6. AlexanderSher commented on Jul 10, 2019

    @AlexanderSher
    Contributor

    Do you have this repro on single unsaved document?

  7. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    No, I've closed the Python file just for screenshot purpose.

    Alexander Sher (@AlexanderSher)

  8. jakebailey commented on Jul 10, 2019

    @jakebailey
    Member

    To be clear, we are asking for the code and installed package list that triggers this problem; it's not easy to fix something we can't reproduce and debug.

  9. AlexanderSher commented on Jul 10, 2019

    @AlexanderSher
    Contributor

    Ok, so looks like we have a bug with six.moves: #746
    But it doesn't hang anything by itself. Kaushal Vora (@kaushall), do you have a file with a minimal repro or it requires a specific project?

  10. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    I understand your concern and I'll try to provide maximum details I can. Jake Bailey (@jakebailey)

    Alexander Sher (@AlexanderSher) It was working fine before the last update of the language server.

    do you have a file with a minimal repro or it requires a specific project?
    No, ,maybe it's specific to project, because whichever file I open it will stuck randomly at analysis stage. Sometime it will stuck on Pandas library and sometime on Six library.

    How it is reproduced?

    Open vs code >> open project >> select python file >> After this it will activate extension and on analysis stage it will stuck.

  11. AlexanderSher commented on Jul 10, 2019

    @AlexanderSher
    Contributor

    Can you add a new python file to your project with only import pandas, and attach full log as a file to the bug?

  12. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    Alright, Provide me few minutes. Alexander Sher (@AlexanderSher)

  13. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    Alexander Sher (@AlexanderSher) I tried with your instruction and analysis completed successfully this time.

  14. AlexanderSher commented on Jul 10, 2019

    @AlexanderSher
    Contributor

    Ok, so pandas works by itself. Can you add to this new file all imports from the file that hangs, close all files, restart VSC and open this new file?

  15. kaushall commented on Jul 10, 2019

    @kaushall
    Author

    Alexander Sher (@AlexanderSher) It stuck again, Here is the result:

    Screenshot from 2019-07-10 12-09-05

  16. 15 remaining items

  17. jakebailey commented on Jul 11, 2019

    @jakebailey
    Member

    proxy returns ReferenceType[Test], which has all of the members of Test, so when a specific type of ReferenceType is constructed, SetClassMembers iterates over the members of Test and creates specific types of them, adding Test as a base, presumably because Test is filling in some T in a generic. That's where this is going wrong.

  18. kaushall commented on Jul 12, 2019

    @kaushall
    Author

    Jake Bailey (@jakebailey) Alexander Sher (@AlexanderSher) Mikhail Arkhipov (@MikhailArkhipov) Thanks for fixing the issue and your hard work.

    Is this fix available in beta/daily channel?

  19. jakebailey commented on Jul 12, 2019

    @jakebailey
    Member

    Yes, in daily, 0.3.27 and above.

  20. kaushall commented on Jul 15, 2019

    @kaushall
    Author
  21. xobs commented on Sep 18, 2019

    @xobs

    I'm experiencing this issue still.

    Downloading https://pvsc.azureedge.net/python-language-server-stable/Python-Language-Server-win-x64.0.3.76.nupkg...
    Language server dowload complete
    Unpacking archive... done
    [Info  - 3:26:06 PM] Microsoft Python Language Server version 0.3.76.0
    [Info  - 3:26:07 PM] Analysis cache path: C:\Users\smcro\AppData\Local\Microsoft\Python Language Server
    [Info  - 3:26:07 PM] GetCurrentSearchPaths C:\Python37\python.exe 
    

    It's stuck at "Analyzing in background, 100 items left". It's using 1GB of RAM. It frequently gets into this state. Reloading the window spins a roulette wheel and has a chance of finishing, but it's not guaranteed.

  22. xobs commented on Sep 18, 2019

    @xobs

    Additionally, it's saying I have undefined variables such as isinstance, hasattr, and range. These aren't variables they are Python keywords.

  23. marcelorosensaft commented on Oct 2, 2020

    @marcelorosensaft

    Hello,

    I'm new here and I have the same problem. I read this and several other threads that were closed after the problem was solved but mine is still here.

    What should I provide to get my problem solved and be able to continue using VSCode?

    Thank you in advance,
    Marcelo

  24. MikhailArkhipov commented on Oct 2, 2020

    @MikhailArkhipov

    marcelorosensaft - Try Pylance language server instead. It is on the VS Code marketplace.

  25. marcelorosensaft commented on Oct 4, 2020

    @marcelorosensaft

    Thank you, Mikhail!

    I installed PyLance and it seems to work very well

  26. baltimoreguy8 commented on Aug 2, 2021

    @baltimoreguy8

    Here is how I solved this issue:

    Go to File > Preferences > Settings > "python.language server"
    If set to 'Microsoft' change your language server to 'Pylance'

    Python: Language Server
    Define Type of the Language Server
    SELECT: Pylance
    

    Reload your Visual Studio Code
    Try importing your libraries causing the issues again:

    import numpy as np
    import pandas as pd
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions