-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
RAM Consumption #263
Comments
Please could you provide some more information on this. |
What process was consuming the memory? Python |
Thanks for the updated info, |
Only experienced once |
I experienced similar problem - python eats whole memory VS Code version: 1.18.1 |
This indicates there a problem with the built in language server (running in python). @iddan @e-cma Also, are any of you using any packages such as numpy, pandas or similar (a package that you believe might be considered large)? |
I looks completion.py eats more than 6 GB of ram. [Edit] |
As I suspected this is an issue with the Jedi library (davidhalter/jedi#843). |
@DonJayamanne |
@Yensan we're obviously sorry to see you go, but we do understand. Please stay subscribed to this issue so that you can stay abreast of any work we do towards fixing this so you can come back and try VS Code and the extension again. |
@brettcannon |
At me too completion.py eats all memory 8G, also a swap 😞 |
More info
|
Same issue here: |
I can also reproduce this problem when working with PyGobject. On sublime text (anaconda plugin) this works without a problem. Here a simple example. Try completion on 'Gtk.Wind' and cpu en mem is 100% used and it never works.
|
I had to uninstall the extension due to this bug. It kills my machine whenever I open a python file from vs code. I currently use an alternative extension (https://marketplace.visualstudio.com/items?itemName=tht13.python) but as there's no debugging support there I desperately need this bug to be fixed. |
@tzachshabtay I'm sorry to hear about this. We are currently looking at this space and will keep you posted. Rather than uninstalling the extension you could probably disable the extension in a specific workspace (this is a new feature introduced in the latest version of VS Code). Finally, please could you confirm you have updated the extension to the latest 0.9.0 release. We have made some improvements around the performance of intellisense/autocompletion within the extension. |
Reproduced with 0.9.1, vs code 1.19.0 (opening the first random python file triggered it). It reached 10 GB in less than a minute. |
Basically looks like Jedi has issues with a) recursive code and b) cache growth. If I hover over regular function, python process size increases by 500K-1MB. If I hover over recursive call, the process memory footprint can easily jump up by 20-30-40MB. Also, it seems to never go down, it appears the cache is never cleaned up for entries not accessed for a long time. |
This is an issue for me on all recent version of VSCode and phytonVSCode on ubuntu 16.04 and 17.04. I can almost reliably trigger this when editing code containing GNURadio. Completion.py eats up more than 32 GB or RAM and makes the machine completely unusable. PLEASE make it possible to disable JEDI and completion.py so we can use the rest of the vscode-python plugin reliably! |
As a workaround you can simply kill python.exe that is running jedi (command line contains completion.py). This will drop intellisense but the rest of the product would keep working. I am trying to figure out what kind of code might be causing jedi to consume memory in a runaway manner. So far I haven't found the case. I mean, RAM usage increases with time, but it does not exceed few hundred megs for me. I'd like to find good repro and report it to jedi. One possible workaround for us might be to monitor memory footprint and restart python process that is running jedi. |
@mmaroti can you provide or point us directly at a repo and exactly what file to open that triggers the memory explosion for you? |
You have to install GNURadio. I usually follow the installation steps outlined here to build it on my machine with all bells and whistles: https://gnuradio.org/doc/doxygen/build_guide.html, https://wiki.gnuradio.org/index.php/BuildGuide. However, there are prepackaged version for ubuntu: apt-get install gnuradio. This will get some older version, and I am not sure that will trigger the problem, but I suspect that it will! To trigger the problem you need to edit python files that reference gnuradio modules. I would recommend this repo: https://github.com/gnuradio/gr-tutorial and edit with intellisense the python files. It takes around 30 minutes for me to trigger it, so it is not deterministic, but maybe you know how to trigger jedi reliably. Let me know if you managed to reproduce the problem. If you do not, then I can set up a virtual machine and try to test it there. |
Yes, working on it. It may be just the fact that GNU Radio is complex. If jedi loads file with ~3000 lines memory grows by ~50MB. So if we request info on a function that is in a big file and calls another function in another big file and so on, each may cause memory to go up but tens of megs. |
Indeed, GNU Radio is very complex and generates large python files (see below). I would be completely happy if I could disable intellisense and/or jedi within vscode-python. As it is, I always keep a terminal with htop running so I can quickly switch to it and kill completion.py before the system becomes unusable. Killing it once is not enough, I think it is restarted. :( mmaroti@maroti-dell:/usr/local/lib/python2.7/dist-packages/gnuradio$ ls -Sl |
Yes, I believe jedi builds ASTs for complete files so chain loading large Python files will consume a lot of memory. Would be interesting to try this in Python tools for VS... I have a prototype solution where we monitor size of the jedi process and exit if predefined limit is exceeded. Completion code then restarts the process upon the next request. Memory threshold can be a setting. This keeps general completion alive but fails completion for complex objects. |
Please see comments in the PR #744 |
@MikhailArkhipov correct me if I'm wrong, but it doesn't look like a fix, just a patch which is good to have but doesn't actually resolve the memory inefficiency (understatement of the year here), so I don't think it's fair closing this issue. As for the patch, does it give up restarting |
I think this is handled by waiting 2 seconds before restarting the process, which is slow enough it wouldn't be a performance problem (I think???). It could repeatedly consume 1GB of RAM (the default maximum). The change does kill auto completion for tensorflow when I tested, as the process dies before completions can be suggested. |
It measures footprint every 2 seconds. The process is restarted immediately. There is no limit on restarts. Yes, it can restart again and again if you are using large code base or library. GNU Radio, for example. But at least basic completion keeps working and machine does not crash. There is no limit on retries. You can increase limit in settings, default is 1GB, max 8GB. @elliott-beach - yes, you may lose suggestions on certain elements - those that cause Jedi to consume RAM in a runaway manner. @tzachshabtay - yes, it is a patch/workaround. There is nothing else we can do with Jedi memory consumption (apart from switching away from Jedi). There are several bugs filed in Jedi github from other projects on the issue. Our goal here is to keep product (and OS) functioning at least at the basic level. |
Looks like the "fix" for this (#744) is launching an external process every 5 seconds to check the completion process size: Is there an option to disable these checks (i only see the |
@zsquareplusc Please could you create a separate issue for what you're experiencing. |
Environment data
VS Code version: 1.18.1 (1.18.1)
Python Extension version: 0.8.0
Python Version: Python 2.7.10 (3.6 in venv)
OS and version: macOS Sierra 10.12.6
The extension process consumed up to 50GB of RAM
The text was updated successfully, but these errors were encountered: