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

"Analyzing in background" forever #946

Closed
thibault opened this issue Apr 12, 2019 · 6 comments · Fixed by #947
Closed

"Analyzing in background" forever #946

thibault opened this issue Apr 12, 2019 · 6 comments · Fixed by #947

Comments

@thibault
Copy link

Hi,

Since recently, I met a problem with VSCode where upon starting the editor, the analyzer starts normally but after a few seconds, the message "Analyzing in background, 877 items left…" is stuck in the footer bar, and then nothing changes (for hours).

It also seems to me that the cpu usage is not enormous but still quite high compared to before this was an issue, around 35 ~ 40%.

Here is the code of the django project that triggers the issue, but I have the exact same problem with other django projects as well.

Vscode version :

Version: 1.33.0
Commit: 0dd516dd412d42323fc3464531b1c715d51c4c1a
Date: 2019-04-04T15:08:57.775Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.15.0-46-generic

Python extension version : 2019.3.6558
LS version : 0.2.53.0

In my settings:

"python.analysis.downloadChannel": "beta",

Also, there is an unhandled exception in the Python output log:

Starting Microsoft Python language server.
##########Linting Output - flake8##########
##########Linting Output - flake8##########
[Info - 15:33:52] GetCurrentSearchPaths /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin/python
[Info - 15:33:52] Python search paths:
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/lib-dynload
[Info - 15:33:52] /usr/lib/python3.6
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/site-packages
[Info - 15:33:52] Configuration search paths:
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python36.zip
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/lib-dynload
[Info - 15:33:52] /usr/lib/python3.6
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/site-packages
[Info - 15:33:52] /home/thibault/Code/aides/src
[Info - 15:33:52] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin
[Info - 15:33:53] Microsoft Python Language Server version 0.2.53.0
[Info - 15:33:53] Initializing for /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin/python
[Info - 15:33:56] Reloading modules...
[Info - 15:34:05] done.
[Info - 15:34:05] Analysis restarted.

Unhandled Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.Dictionary2.ValueCollection.Enumerator.MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext()
at Microsoft.Python.LanguageServer.Implementation.Server.RestartAnalysis()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ThreadPoolWorkQueue.Dispatch()
[Info - 15:34:07] Connection to server got closed. Server will restart.
[Info - 15:34:08] GetCurrentSearchPaths /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin/python
[Info - 15:34:08] Python search paths:
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/lib-dynload
[Info - 15:34:08] /usr/lib/python3.6
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/site-packages
[Info - 15:34:08] Configuration search paths:
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python36.zip
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/lib-dynload
[Info - 15:34:08] /usr/lib/python3.6
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/lib/python3.6/site-packages
[Info - 15:34:08] /home/thibault/Code/aides/src
[Info - 15:34:08] /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin
[Info - 15:34:09] Microsoft Python Language Server version 0.2.53.0
[Info - 15:34:09] Initializing for /home/thibault/.local/share/virtualenvs/aides-WKfJSWUb/bin/python
##########Linting Output - flake8##########
##########Linting Output - flake8##########
[Error - 15:42:13] Unable to find document file:///home/thibault/Code/aides/src/core/urls.py
[Error - 15:42:15] Unable to find document file:///home/thibault/Code/aides/src/core/urls.py
##########Linting Output - flake8##########
[Info - 15:45:47] Reloading modules...
[Info - 15:45:48] done.
[Info - 15:45:48] Analysis restarted.

Please let me know if you need anymore details.

@MikhailArkhipov
Copy link

Looks like similar to #943

@thibault
Copy link
Author

@MikhailArkhipov It seems that you are right. The main difference is that owner of ticket #943 states that the problem is non repeatable. For me, the problem happens every time.

@doxxx
Copy link

doxxx commented Apr 12, 2019

This is not the same as #943, as far as I can tell, because I'm seeing the "analyzing in background" forever while I can see that the LSP process is still running in Task Manager, with 0% CPU.

@MikhailArkhipov
Copy link

There are three issues here.

First is the exception (which is being fixed in #947).

Second, the stale message - the analysis either finished or the exception caused it to terminate and progress message has never been updated or removed. This is confirmed that LS process is running with 0% CPU which means it is done. LS process always runs as long as VS Code has some Python file opened.

Third, is the analysis taking long time. This is not a single issue and various optimizations are being added or considered in other issues. Some libraries consist or thousands of files and since Python is typeless language and stubs are not very common, evaluation of the code flow has to be performed.

If CPU is at 0% and tooltips/completions are available then the analysis is done. After the exception is fixed and build published, I would recommend opening separate issue on stale message (if it still happens) and another on the speed of analysis in the particular project.

Thanks!

@kaushall
Copy link

kaushall commented Jul 4, 2019

Please release this change in early release or stable release as soon as possible.

@MikhailArkhipov @DonJayamanne

@jakebailey
Copy link
Member

This issue is two months old; the code that was merged to fix this specific issue has been released for some time now. If you are having a problem, please file an issue with the info we request in https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants