python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

"Analyzing in background, X items left..." displays indefinitely.

Open spencertollefson opened this issue 4 years ago • 9 comments

Environment data

  • Language Server version: 0.5.46.0
  • OS and version: MacOS Catalina 10.15.3
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.2 from Homebrew [email protected]

Expected behaviour

For background analysis to complete within a reasonable amount of time -- and by extension for PLS to perform tasks, such as simple renaming of variables via refactoring and intelliSense suggestions, to work pretty quickly.

Actual behaviour

After loading (or reloading) a VS Code workspace, the PLS takes a few seconds to get settled, and then it performs as expected. Within a few minutes of working within it, I have noticed when using the Rename Symbol command that it operates extremely slowly and intelliSense does not suggest methods. At this point I have consistently seen the a spinning wheel with the words Analyzing in background, X items left... (usually 3, 4, or 5) items. It stays there indefinitely until I Reload Window.

Logs

[Info  - 1:12:24 PM] Analysis cache path: /Users/spencer/Library/Caches/Microsoft/Python Language Server
[Info  - 1:12:24 PM] Microsoft Python Language Server version 0.5.46.0
[Info  - 1:12:24 PM] Workspace root: /Users/spencer/projects/use_case_data_pulls
[Info  - 1:12:24 PM] GetCurrentSearchPaths /Users/spencer/.virtualenvs/use_case_data_pulls/bin/python3.8 
[Info  - 1:12:24 PM] Interpreter search paths:
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
[Info  - 1:12:24 PM] User search paths:
[Info  - 1:12:24 PM]     /Users/spencer/projects/use_case_data_pulls/scripts
[Info  - 1:12:27 PM] Initializing for /Users/spencer/.virtualenvs/use_case_data_pulls/bin/python3.8
[Info  - 1:12:27 PM] Analysis caching mode: None.
Opening document file:///Users/spencer/projects/use_case_data_pulls/scripts/helpers/use_case_query_class.py
Analysis of helpers.use_case_query_class (User) queued. Dependencies: csv, entity_recognition.taxonomyStorage
Import:  csv /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/csv.py 
Analysis of csv (Stub) queued. Dependencies: collections (stub), sys (stub), _csv (stub)
Import:  entity_recognition.taxonomyStorage /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/entity_recognition/taxonomyStorage.py 
Analysis version 2 of 1 entries has started.
Analysis of csv (Library) queued. Dependencies: csv (stub), re, _csv, io
Analysis of entity_recognition.taxonomyStorage (Library) queued. Dependencies: re, json, grab_model, grab_model.model_finder
Import:  re /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py 
Analysis of _csv (Stub) queued. Dependencies: sys (stub)
Analysis of sys (Stub) queued. Dependencies: types (stub), importlib.abc (stub)
Analysis of re (Stub) queued. Dependencies: sys (stub), enum (stub)
Create compiled (scraped):  _csv /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/_csv.cpython-38-darwin.so /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload 
Analysis of collections (Stub) queued. Dependencies: sys (stub), collections.abc (stub)
Analysis of re (Library) queued. Dependencies: re (stub), enum, sre_compile, sre_parse, functools, _locale, copyreg, sre_constants
Import:  io /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/io.py 
Analysis of _csv (Compiled) queued. Dependencies: _csv (stub)
Analysis of io (Library) queued. Dependencies: io (stub), _io, abc
Import:  json /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py 
Analysis of json (Stub) queued. Dependencies: sys (stub), json.decoder (stub), json.encoder (stub)
Analysis of io (Stub) queued. Dependencies: codecs (stub), mmap (stub), sys (stub), types (stub)
Import:  grab_model /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grab_model/__init__.py 
Analysis of grab_model (Library) queued. Dependencies: 
Import:  grab_model.model_finder /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grab_model/model_finder.py 
Analysis of json (Library) queued. Dependencies: json (stub), json.decoder, json.encoder, codecs, warnings
Analysis of helpers.use_case_query_class (User) queued. Dependencies: csv, entity_recognition.taxonomyStorage, io
Analysis of grab_model.model_finder (Library) queued. Dependencies: boto3, operator, os
Analysis of collections.abc (Stub) queued. Dependencies: sys (stub), collections (stub)
Import:  enum /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/enum.py 
Analysis of types (Stub) queued. Dependencies: sys (stub), _importlib_modulespec (stub)
Analysis of modules loop on depth 1 in 70.75 ms:
    elasticsearch.connection.http_requests(Library)
    elasticsearch(Library)
    elasticsearch.transport(Library)
    elasticsearch.client(Library)
    elasticsearch.connection.base(Library)
    elasticsearch.connection.http_urllib3(Library)
    elasticsearch.connection(Library)

<<<<<<
Skipping tens of thousands of similar "Analysis" lines...
>>>>>>
Analysis of botocore.config (Library) on depth 5 completed in 0.78 ms.
Analysis version 5926 has been completed in 6904.52 ms with 1427 entries analyzed and 725 entries skipped.
Forcing full garbage collection and heap compaction.

Code Snippet / Additional lnformation

I've seen a few closed Issues similar to this one. I tried a few of the suggestions in those, such as ensuring that python:jediEnabled is set to False and ensuring my VS Code and PLS packages are up to date (I used the dailychannel for some time, no help).

Issue #1806 seems to be the same as my issue. However, that was closed due to inactivity. If I should re-open that issue, please let me know.

spencertollefson avatar Mar 30 '20 13:03 spencertollefson

Those are the VS Code debug logs, not the language server logs. We would need the language server logs. https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue

jakebailey avatar Mar 30 '20 16:03 jakebailey

Ah my apologies. Below are the beginning and end of the logs. I cut out the middle because it was too long. It seems to all be "Analysis of" messages. I attached the full logs as a TXT file.

PLS_Logs.txt

To reproduce this:

  • Opened a project I had been working on
  • Began writing a line with pathlib.Path.unlink(). I had already imported pathlib. At some point while writing the method, before finishing, I saw that the Analyzing files in background message appeared and jumped between 600 and 2000 items. It finally settled at 3 items, and hung there 10+ minutes before I closed the window.
  • At this point, was unable to use intelliSense on pathlib.Path.

Abbreviated Logs

[Info  - 1:12:24 PM] Analysis cache path: /Users/spencer/Library/Caches/Microsoft/Python Language Server
[Info  - 1:12:24 PM] Microsoft Python Language Server version 0.5.46.0
[Info  - 1:12:24 PM] Workspace root: /Users/spencer/projects/use_case_data_pulls
[Info  - 1:12:24 PM] GetCurrentSearchPaths /Users/spencer/.virtualenvs/use_case_data_pulls/bin/python3.8 
[Info  - 1:12:24 PM] Interpreter search paths:
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload
[Info  - 1:12:24 PM]     /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
[Info  - 1:12:24 PM] User search paths:
[Info  - 1:12:24 PM]     /Users/spencer/projects/use_case_data_pulls/scripts
[Info  - 1:12:27 PM] Initializing for /Users/spencer/.virtualenvs/use_case_data_pulls/bin/python3.8
[Info  - 1:12:27 PM] Analysis caching mode: None.
Opening document file:///Users/spencer/projects/use_case_data_pulls/scripts/helpers/use_case_query_class.py
Analysis of helpers.use_case_query_class (User) queued. Dependencies: csv, entity_recognition.taxonomyStorage
Import:  csv /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/csv.py 
Analysis of csv (Stub) queued. Dependencies: collections (stub), sys (stub), _csv (stub)
Import:  entity_recognition.taxonomyStorage /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/entity_recognition/taxonomyStorage.py 
Analysis version 2 of 1 entries has started.
Analysis of csv (Library) queued. Dependencies: csv (stub), re, _csv, io
Analysis of entity_recognition.taxonomyStorage (Library) queued. Dependencies: re, json, grab_model, grab_model.model_finder
Import:  re /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py 
Analysis of _csv (Stub) queued. Dependencies: sys (stub)
Analysis of sys (Stub) queued. Dependencies: types (stub), importlib.abc (stub)
Analysis of re (Stub) queued. Dependencies: sys (stub), enum (stub)
Create compiled (scraped):  _csv /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload/_csv.cpython-38-darwin.so /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload 
Analysis of collections (Stub) queued. Dependencies: sys (stub), collections.abc (stub)
Analysis of re (Library) queued. Dependencies: re (stub), enum, sre_compile, sre_parse, functools, _locale, copyreg, sre_constants
Import:  io /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/io.py 
Analysis of _csv (Compiled) queued. Dependencies: _csv (stub)
Analysis of io (Library) queued. Dependencies: io (stub), _io, abc
Import:  json /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py 
Analysis of json (Stub) queued. Dependencies: sys (stub), json.decoder (stub), json.encoder (stub)
Analysis of io (Stub) queued. Dependencies: codecs (stub), mmap (stub), sys (stub), types (stub)
Import:  grab_model /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grab_model/__init__.py 
Analysis of grab_model (Library) queued. Dependencies: 
Import:  grab_model.model_finder /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grab_model/model_finder.py 
Analysis of json (Library) queued. Dependencies: json (stub), json.decoder, json.encoder, codecs, warnings
Analysis of helpers.use_case_query_class (User) queued. Dependencies: csv, entity_recognition.taxonomyStorage, io
Analysis of grab_model.model_finder (Library) queued. Dependencies: boto3, operator, os
Analysis of collections.abc (Stub) queued. Dependencies: sys (stub), collections (stub)
Import:  enum /usr/local/Cellar/[email protected]/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/enum.py 
Analysis of types (Stub) queued. Dependencies: sys (stub), _importlib_modulespec (stub)
Analysis of modules loop on depth 1 in 70.75 ms:
    elasticsearch.connection.http_requests(Library)
    elasticsearch(Library)
    elasticsearch.transport(Library)
    elasticsearch.client(Library)
    elasticsearch.connection.base(Library)
    elasticsearch.connection.http_urllib3(Library)
    elasticsearch.connection(Library)

<<<<<<
Skipping tens of thousands of similar "Analysis" lines...
>>>>>>

Analysis of botocore.config (Library) on depth 5 completed in 0.78 ms.
Analysis version 5926 has been completed in 6904.52 ms with 1427 entries analyzed and 725 entries skipped.
Forcing full garbage collection and heap compaction.

spencertollefson avatar Mar 30 '20 19:03 spencertollefson

Is there any more information I can provide for this issue?

spencertollefson avatar Apr 30 '20 13:04 spencertollefson

No, we just haven't had time to test and repro this. The logs do indicate it getting stuck at the end, similarly to a few other reported issues.

jakebailey avatar Apr 30 '20 17:04 jakebailey

Thanks for the quick reply - much appreciated!

spencertollefson avatar Apr 30 '20 17:04 spencertollefson

i experienced this problem too. when i create a debug configuration (launch.json) the analysing does finish and intelisense starts working for me for imported packages like tensorflow.

malger avatar May 15 '20 13:05 malger

same issue

lavaner avatar May 21 '20 02:05 lavaner

Update: I've moved to using Pylance, and am not having this hang up any more!

spencertollefson avatar Jul 20 '20 15:07 spencertollefson

same issue

Jebearssica avatar Nov 11 '20 05:11 Jebearssica