Repository navigation
Extension enters duplicate data into local globalStorage sqlite db #17488
Description
Environment data
- VS Code version:
1.60.1 - Extension version (available under the Extensions sidebar):
v2021.9.1246542782 - OS and version:
Darwin x64 20.6.0 - Python version (& distribution if applicable, e.g. Anaconda): Multiple (
pyenv) - Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Multiple (all three listed)
- Relevant/affected Python packages and their versions: N/A
- Relevant/affected Python-related VS Code extensions and their versions:
ms-python.python - Value of the
python.languageServersetting:Pylance
Expected behaviour
Extension does not fill the local globalStorage sqlite db (Memento) with erroneous data and maintains a list of available python interpreters.
When left unchecked this can lead to the extension host behaving in unexpected ways and it was difficult to diagnose without significant effort (see #17432 for original issue).
Actual behaviour
Each reload of a window causes PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS under the ms-python.python key to grow. Under most circumstances the list of environments underneath is not refreshed, i.e environments that are no longer on the machine are still shown.
This is a copy of the ms-python.python key before I managed to clear the cache by deleting the extension and going through the steps listed here:
Note: There are 712 matches to INTERPRETERS_CACHE in that file.
Steps to reproduce:
Unsure how to recreate the stale environments issue (seems cache related) but for the ever growing list of PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS:
- Completely remove extension from machine.
delete from ItemTable where key = 'ms-python.python';in~/Library/Application\ Support/Code/User/globalStorage/state.vscdb(mac).- Confirm key is empty in db.
- Reinstall extension.
- Reload window.
- Note entry under
ms-python.pythonin the db. - Reload window.
- Note entry under
ms-python.pythonin the db (PYTHON_EXTENSION_GLOBAL_STORAGE_KEYSwill have grown in size and contain duplicate entries).
Logs
Nothing of note is captured in the logs.
Activity
[-]Extension enters erroneous data into local `globalState` sqlite db[/-][+]Extension enters erroneous data into local `globalStorage` sqlite db[/+]karrtikr commentedon Sep 22, 2021
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.
4 remaining items
mattseddon commentedon Oct 5, 2021
Kartik Raj (@karrtikr) I have just tested this and it does appear to have made things better. I can see that
PYTHON_EXTENSION_GLOBAL_STORAGE_KEYShas been deprecated:I am still seeing duplicates being created in the
PYTHON_GLOBAL_STORAGE_KEYSarray though:I don't think that you can close the ticket using the current fix.
karrtikr commentedon Oct 5, 2021
Thanks for reporting back. The VSIX I provided initially is actually outdated as PR got updated further, can you try https://github.com/microsoft/vscode-python/suites/3954255787/artifacts/99265047 which appears to be the latest VSIX on the PR. Alternatively, you can try
Python: Switch to Insiderscommand and wait a bit to install the latest insiders version of the extension.karrtikr commentedon Oct 5, 2021
FYI I can verify there's still an issue with
PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS, however I expect the keyPYTHON_ENV_INFO_CACHEto not appear multiple times.mattseddon commentedon Oct 5, 2021
I am also seeing the issue with
PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS. Maybe the other issue is coming from the firstvsixthat I installed. I have 4 entries now but it appears to be stable:The list of
PYTHON_EXTENSION_GLOBAL_STORAGE_KEYSseems to be ever growing.karrtikr commentedon Oct 5, 2021
I see, thanks for confirming. You can use the command
Python: Clear Internal Extension cacheto clear this storage anytime as well.karrtikr commentedon Oct 5, 2021
Matt Seddon (@mattseddon) Can you please try https://github.com/microsoft/vscode-python/suites/3965062360/artifacts/99642505, thanks!
mattseddon commentedon Oct 5, 2021
Kartik Raj (@karrtikr) that seems to have fixed the issue.