Closed AnsonSavage closed 1 month ago
Thanks for the issue. What's your version of node on the remote machine?
Logging should be here (although it looks like it's crashing immediately:
If you're using an older node, you might try upgrading. VS code ships with 20.9.0, so specifying your own node, you might need to have a similar version.
Ahh, okay. I couldn't find that dropdown in the UI, but the system administrators I was working with had me point it to v18.19.1
.
If you restart does it work? That error might have been because you set the node executable but didn't restart VS code (the Python extension was attempting to shutdown the old version maybe).
Good point. I've both restarted VS Code and reconnected to the remote several times.
Might be something about node on your remote machine then. You can try the command we run internally yourself to see if it gives you any extra output.
it should be something like:
<path to node> \home\username\.vscode-server\extensions\<pylance extension path>\dist\server.bundle.js
Sometimes global node environment variables can make running node by itself not work for us.
Alternatively we could try and figure out why using the VS code node crashed/ran out of memory.
Okay!
I got this output after running that command:
You may install and use any number of copies of the software only with Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, Azure DevOps, Team Foundation Server, and successor Microsoft products and services (collectively, the “Visual Studio Products and Services”) to develop and test your applications. The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. You may not: work around any technical limitations in the software that only allow you to use it in certain ways; reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software, except and to the extent required by third party licensing terms governing use of certain open source components that may be included in the software; remove, minimize, block, or modify any notices of Microsoft or its suppliers in the software; use the software in any way that is against the law or to create or propagate malware; or share, publish, distribute, or lease the software (except for any distributable code, subject to the terms above), provide the software as a stand-alone offering for others to use, or transfer the software or this agreement to any third party.
I would also be down to learn why VS Code's node ran out of memory.
That output is actually expected, it's what happens when Pylance runs without VS code, but that means it didn't crash which is good/bad (bad in that we don't have an easy way to figure out why VS code is crashing pylance).
Can you share your source? That would be the easiest way to figure out the memory problem. We can reproduce it in house and analyze all the data.
You can e-mail the source too if you don't want to share it publicly. My e-mail is my github id at microsoft.com.
If you can't share the source, you might try some other techiques listed at the help for the python.analysis.nodeExecutable
setting: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#pylance-is-crashing
Like:
We'd rather just make our software use less memory though if we can reproduce the issue.
Hello! I think I can, what does sharing the source mean?
The easiest way is if your source code is in a public github repository. Then we just git clone your source and try to reproduce the issue.
Otherwise you'd likely need to send or upload a zip file of the source.
Ah, I see!
The problem persists regardless of what repo I'm working in remotely.
So any python code will cause pylance to crash?
Can you get logs for pylance and upload them according to the directions here?
https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue
I may have made an incorrect assumption, that you were running out of memory. Something else might be causing a crash.
Okay! Here's what I've seen this morning:
2024-07-24 09:57:57.273 [info] [Info - 9:57:57 AM] (3216640) Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting
2024-07-24 09:57:57.273 [info] [Info - 9:57:57 AM] (3216640) Server root directory: file:///home/ansonsav/.vscode-server/extensions/ms-python.vscode-pylance-2024.7.1/dist
2024-07-24 09:57:57.284 [info] [Info - 9:57:57 AM] (3216640) Starting service instance "archive"
2024-07-24 10:03:40.328 [info]
<--- Last few GCs --->
[3216640:0x55e2ac0] 338812 ms: Mark-sweep 8043.1 (8227.0) -> 8037.7 (8237.3) MB, 5946.1 / 0.0 ms (average mu = 0.474, current mu = 0.145) allocation failure; scavenge might not succeed
[3216640:0x55e2ac0] 343807 ms: Mark-sweep 8053.5 (8237.3) -> 8046.2 (8245.3) MB, 4941.1 / 0.0 ms (average mu = 0.306, current mu = 0.011) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
2024-07-24 10:03:40.329 [info] 1: 0xb91950 node::Abort() [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.330 [info] 2: 0xa85713 [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.330 [info] 3: 0xd758b0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.331 [info] 4: 0xd75c46 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.332 [info] 5: 0xf5e645 [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.332 [info] 6: 0xf6ec7d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.333 [info] 7: 0xf47bea v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.334 [info] 8: 0xf48e04 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.335 [info] 9: 0xf2780d v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.335 [info] 10: 0x1315b1d v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:40.336 [info] 11: 0x1775fb9 [/apps/nodejs/18.19.1/gcc-11.3.1/bin/node]
2024-07-24 10:03:42.066 [info] [Info - 10:03:42 AM] Connection to server got closed. Server will restart.
2024-07-24 10:03:42.066 [info] true
2024-07-24 10:03:42.079 [info] [Error - 10:03:42 AM] Server process exited with signal SIGABRT.
2024-07-24 10:03:42.946 [info] [Info - 10:03:42 AM] (3236372) Pylance language server 2024.7.1 (pyright version 1.1.369, commit 1168be71) starting
2024-07-24 10:03:42.946 [info] [Info - 10:03:42 AM] (3236372) Server root directory: file:///home/ansonsav/.vscode-server/extensions/ms-python.vscode-pylance-2024.7.1/dist
2024-07-24 10:03:42.958 [info] [Info - 10:03:42 AM] (3236372) Starting service instance "archive"
Interestingly, since it crashed and restarted, it hasn't crashed again but it also hasn't been able to perform any Python Language features (e.g., identify variables, go to variable references, etc.)
Thanks!
I solved this issue by upating node to the latest available version and by changing the following setting:
python.analysis.nodeExecutable = "/home/your_user/.nvm/versions/node/v20.16.0/bin/node"
I hope this will help...
@AnsonSavage that is an out of memory problem. So my original assumption was correct.
We'd need access to the source code you're using in order to reproduce the issue. The directory with all of your python code in it.
You might also try what @zuliani99 suggested and upgrade your node executable.
Okay. I'm logged in to a remote node that has many subfolders and many repositories. From the workspace root, there are 282260 Python files. (I'm assuming that this is what is causing Pylance to crash.)
However, it is helpful to use VSCode and log in such that I can see all the folders on our entire system. Is it possible to tell Pylance that I want to limit its processing to a directory and its subdirectories so that it's only processing and managing the Python for the particular code that I'm working on?
Yes actually there's a description of how to do that here: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#exclude-unneeded-py-files-from-analysis
You can exclude everything you're not currently working on using the python.analysis.include
and the python.analysis.exclude
settings.
They're also described in more detail here: https://microsoft.github.io/pyright/#/configuration?id=main-configuration-options
Okay, so say I'm coding in RLL_co-detr directory.
Could I create an additional .vscode and settings.json file like this?
You would need to do that in the root though, not in that folder. Pylance is analyzing the entire workspace so it would still include everything else.
or you could just open that folder directly and setup your 'extraPaths' in the .vscode/settings.json to include the folder(s) you need to load imports.
Ah, I see! Okay, I'll give that a try. Thank you!
Awesome, that looks like it worked!!
Thank you so much! Anson
THanks, glad it worked.
Similar to this issue: https://github.com/microsoft/pylance-release/issues/5245
While using SSH to work remotely in VS Code, I got this error:
I resolved this error by setting the path to Node explicitly here:
However, now I get these kinds of errors:
The corresponding output is:
Environment data
Logs
I've enabled logging, but I don't see any output. When I do something like press F12 on a Python variable, I just see the blue loading bar with no output.
Thanks! Anson