-
Notifications
You must be signed in to change notification settings - Fork 133
"Analyzing in background" message stuck with caching enabled (deadlock, no CPU usage) #1601
Comments
It's possible that this is triggered by saving the file. Relatedly: Sometimes PLS gives "Undefined" error messages for things like |
#1573 may be related. Does upgrading to the daily build (at least 0.4.34) fix the issue? https://github.com/microsoft/python-language-server/wiki/Versioning-and-download-channels |
I've been reliably encountering this on the daily build. |
Actually on .4.37.0 from the daily build, when opening a Python buffer with nothing but |
@jakebailey I'm now running: `[Info - 1:21:38 AM] Microsoft Python Language Server versio analyzing - 0.4.36.0 stuck.txt I have attached the log from it. Again, PLS is using up an entire core, and is stuck at "Analyzing in background, 3 items left..." |
That's a really strange log. |
It downloaded |
Having the same issue with and without the daily build enabled. This has been a recurring issue. I hope you guys can find a definitive solution soon. |
@petrosschilling - what are your imports (major libraries) and could you please provide the log from the output window?
|
@xobs - does it complete if you just open the workspace? I see from the log that files are being edited (its normal) so analysis restarts for the changed file and any modules that import it (i.e. something that depends on the changed file) which brings more stuff into view. |
@MikhailArkhipov Yes, it does usually complete if I just open the workspace. It's non-deterministic. Usually reloading the window fixes it on the first try, but I've seen instances where it takes two or three reloads to get it to successfully complete. |
@xobs, @malmaud @petrosschilling - is activity in the output window continues or there is no activity and the message is stuck on some number of remaining? |
@MikhailArkhipov I'm on the beta channel, and I am getting syncing errors. The log says:
but the status bar says:
Not sure if this is the same issue other people are having those since in my case nothing is analyzing, but the UI is telling me that it is. At one point this morning, I did have to kill the VS Code because the python language server process was eating 11GB of RAM, but that seems like a completely different issue as it is not eating memory or CPU right now. Restarting VS Code gets me the same disconnect between the log output and the UI display. |
Out of curiosity, are any of you using WSL? |
@jakebailey I am not. I'm running on macOS 10.14.6. I will note, that the codebase I work on includes a bunch of stuff that seems to trigger issues with MS-PLS from time to time, specifically:
(note: that |
I am having a similar issue on RHEL.
The status bar says "analyzing in background.... 7812 items left" On Microsoft Python Language Server version 0.4.41.0. |
So it looks like the message is stuck rather than analysis keeps running. |
The message is stuck in some number remaining The log generated by Python Language Server: |
@MikhailArkhipov There is no activity in the output window. Task Manager reports a "Python Language Server" using 25% CPU, which is one core of my four-core system. I have WSL installed, but this is using a Python installed in Windows and not in WSL. |
@MikhailArkhipov In my case, the number of items remaining/analyzed also keeps changing. After a fresh start on the workspace, it says that there were ~4300 items analyzed. After developing for a while, it says that it was analyzing ~7100 items. Sometimes the number grows to ~9k. This number is reflected in the logs and in the (stuck) UI display message. I haven't added thousands of files to the project, so I'm not sure what to make of this. It could be related, or a completely different issue. |
My analyzing status number goes up but never comes back down. |
Here it got stuck on 0.4.44.0. It was stuck previously, so I did analyzing - 0.4.44.0 stuck.txt Though in this case, there isn't a process using up 25% of one CPU. However, there is an additional symptom: if I open another tab, then that tab never gets analyzed. So it definitely appears to be wedged somewhere. |
I can repro the case when message is getting stuck (analysis does complete) if I open several files which import sizeable libraries, then close some while analysis is still running. Could be that progress tracker does not account for the fact that some items got canceled. |
The analysis gets stuck indefinitely.
How to reproduce? |
Same problem here with Windows 10, in Remote WSL, last version of vscode and Python extension (2019.10.44104). I tried multiple older versions, same problem each time. I think it began to append after I installed a lot of new libraries with pip. When analysing is stuck, completion, hover and code validation are working very very slowly or even not at all. Caching level does not change anything. I also see a lot 2 errors in debug console :
and
|
I'm seeing this issue as well: VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:33:00.827Z) System Info
Extensions (21)
python3 3.7.4_1 Caching enabled or disabled makes no difference. Screen cap of trace logging and the "Analzying" message attached. Also some code completion is not working. |
Here is a process sample while the language server is stuck. I've also tried downgrading the extension version to a month ago and downgrading pythong to 3.7.3. Neither helped. process sample
|
Unfortunately, since we're in C#, a typical dump won't give us the info of what's going on inside the C# runtime (just the state of the runtime itself and some native resources). It's be incredibly helpful to get a proper dump from a .NET Core debugger, which I believe would be vsdbg (or attaching to the process using the C# VS Code extension, though I'km not sure how to get a plaintext output that way). |
Thanks for doing this; we include PDBs with our builds so what it's able to show (filenames on the right) would be what we want, e.g. Everything on that list is "normal" from what I can see, however (file watching, stdin read blocking for the language server protocol, a wait for the RPC server to exit). Are there more threads than just those listed in those screenshots? |
That's it, aside from a few more |
I've got it reproducing on my Arch machine, but I'll let you know if it doesn't pan out. |
So at this point I'm almost thinking there are two issues happening in this thread:
I think I may have already fixed the first with my previous PR. On my Arch machine, I've tested and completely removed the second of the two locks which were interacting poorly, and still get the lockup. LLDB with SOS's list of the allocated tasks and threads shows that there's just nothing going on or hanging, which combined with the behavior in my second bullet point leads me to believe that a session is ending, but the next one doesn't start up again. That would explain the fact that it doesn't appear to be locked in any traditional way and that the logs will show that something is actually happening on user input (even if the result is "everything is canceled" with "No AST found"). |
Findings at this point:
|
I've figured it out! PR incoming. A combination of a number of bugs in various different parts of the code to do with caching. |
The hang due to caching was fixed in my PR, but #1686 conflicted with caching in general, so we've disabled caching for the time being. Those on the beta channel should have their hanging fixed, either way. Stable users never had caching enabled so wouldn't have hit this hang. See #1737 if you'd like a writeup on what the issue was (if you're into that sort of thing 🙂). |
I'm still seeing this issue on both stable and beta channels. Does it make sense to open a new one or resurrect this one? |
If your analysis is stuck and you definitely have caching disabled (the logs give the caching level), then that's a different hang and I'd appreciate a new issue. |
I'm still on daily, and running 0.4.127.0. Should this be fixed? It's stuck right now at "Analyzing in background, 3 items left..." and it seems frozen. Doing a mouseover on items just says "Loading...", and there is one part that is underlined in red that says "unexpected token ''" which is not an actual error anymore (it popped up as I was typing the line).
|
This issue was specifically when caching was enabled, and the fix was in caching. The issue is fixed, and caching is disabled anyway. Your issue sounds different and unrelated. |
Alright, this issue is the same as the one I originally reported in #1601 (comment), so given that I'm running |
No, this case was specifically about caching. You can is different since it no longer about cache. Feel free to open a new issue. Thanks. |
I see, I didn't realize that someone changed the bug name to indicate it was a caching problem. I don't have caching, so I'll re-post the bug with the original name. |
Was this ever released? I still seem to be getting this issue. I am on windows but using the remote wsl plugin to edit code from within WSL. Is there anything I can provide to help? |
Yes, this was released in November when this issue was closed. If you have another hang, it'd be best to create a new issue with your reproducer/the info the issue asks for. |
Environment data
Expected behaviour
Python Language Server shouldn't get stuck analyzing files.
Actual behaviour
After a random amount of time using PLS (e.g. after anywhere from 0 minutes to several days), Visual Studio Code gets stuck "Analyzing in background...". The number of items is frequently small, but not always.
Logs
See attached. This is a log from several days, so that I could capture the issue
analyzing - stuck.txt
Additional
This repository is from https://github.com/xobs/haddecks
My local
settings.json
file looks like this:There is no .env file present.
The text was updated successfully, but these errors were encountered: