question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension enters duplicate data into local `globalStorage` sqlite db

See original GitHub issue

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.languageServer setting: 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 https://github.com/microsoft/vscode-python/issues/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:

globalStorage.txt

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:

  1. Completely remove extension from machine.
  2. delete from ItemTable where key = 'ms-python.python'; in ~/Library/Application\ Support/Code/User/globalStorage/state.vscdb (mac).
  3. Confirm key is empty in db.
  4. Reinstall extension.
  5. Reload window.
  6. Note entry under ms-python.python in the db.
  7. Reload window.
  8. Note entry under ms-python.python in the db (PYTHON_EXTENSION_GLOBAL_STORAGE_KEYS will have grown in size and contain duplicate entries).

Logs

Nothing of note is captured in the logs.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
mattseddoncommented, Oct 5, 2021

@karrtikr that seems to have fixed the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow an extension to clear memento storage · Issue #134424 ...
We (python extension) have accidentally stored large contents in the ... Extension enters duplicate data into local globalStorage sqlite db ...
Read more >
SQLite3 - Preventing duplicate entries from being entered into ...
Let the database do the work. Create a unique index. This will prevent such duplication: create unique index unq_notify_users_2 on ...
Read more >
Command Line Shell For SQLite
Type in SQL statements (terminated by a semicolon), press "Enter" and the SQL will be executed. For example, to create a new SQLite...
Read more >
A SQLite extension for making HTTP requests / Alex Garcia
I'll run a local server with Python/Node/whatever that can perform the complex calculations, and returning data as JSON for SQLite to hook into....
Read more >
SQLite - DISTINCT Keyword - Tutorialspoint
Local SQLite Database with Node for beginners ... Following is the basic syntax of DISTINCT keyword to eliminate duplicate records.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found