-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pylance crashing repeatedly due to increased memory usage (Remote ssh+virtualenv) #706
Comments
VS Code launches Pylance in a 32-bit process, so the heap size is limited to about 2GB. So setting the node limit higher won't help. You shouldn't need to adjust the memory size anyway. Pylance shouldn't be running short on memory in the scenario you described. We've fixed a few other bugs in the past that have resulted in similar behaviors, but we haven't had any further reports since then. By any chance, is your project in a public github repo? Or would you be able/willing to send us the python files that comprise the project? That would help us repro and diagnose the problem. |
Please find the sample code in this repo https://github.com/swd543/pylance-debug/tree/master. I am able to reproduce the crashes on a fresh virtual environment. I am curious as to why VS code would launch pylance in a 32 bit process. This would automatically limit the usage on higher end systems. |
I'm not sure that it starts in a 32 bit process (I think it depends on your VSC version), but node's default heap size is limited to 2GB regardless. I don't believe that exporting the variable works as our client doesn't pass every environment variable down. |
Thanks for the repro steps. I found the reason why we were running out of memory. The "SimpleITK" package contains a combination of ".py", ".pyi", and ".so" files. Pylance was incorrectly treating one of ".so" files as a Python file and attempting to parse it as though it were text. As you can imagine, this doesn't go well. This will be fixed in the next release. |
Brilliant! Thanks for debugging and fixing this issue! |
This issue has been fixed in version 2020.12.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020122-11-december-2020 |
I've seen issues similar to mine before (#142, #254) which were apparently resolved for every next version of pylance released - I'm using the latest version of pylance from the stable channel as of writing and this issue is seen when working on a data science project on a remote server with virtualenv. I tried increasing the amount of memory available to pylance by setting an environment variable for node but apparently that is not respected. Setting the memory limit should be provided as a configuration option.
Environment
Expectation
Observation
top
the process corresponding to the language server (node) caps out at 2.8GB of virtual memory after which it crashes withAllocation failed - JavaScript heap out of memory
~/.vscode-server
and redownloading the extensions, does not fix the issuenode
process, I added the following line to~/.profile
-export NODE_OPTIONS=--max-old-space-size=32000
to increase the amount of heap memory available to pylance, then restarted pylanceVirtualenv
It is located on the remote server at
~/.Environments/torch/bin/python3
. The project is not too big, has around 5 python files and around 300 lines of code in total.Logs
Trace output of server
Crash dump
The text was updated successfully, but these errors were encountered: