microsoft / microsoft/Kusto-Explorer-VsCode

Schema cache stores ~950KB in globalState, triggering VS Code's large-extension-state warning

Open
#151 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
6
Forks
7
Avg merge
6d 10h
Merged PRs (30d)
3

Description

Problem

VS Code logs this warning repeatedly during normal use:

[warning] [mainThreadStorage] large extension state detected
(extensionId: ms-kusto.kusto-explorer-vscode, global: true): 949.6767578125kb.
Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.

Roughly 950 KB is being held in globalState, and the warning repeats as the value is rewritten.

Where it comes from

The schema cache. Per ARCHITECTURE.md, schema is cached at two levels: in-memory in SchemaManager, plus VS Code storage across sessions via the kusto/getData / kusto/setDataglobalState bridge, so startup is usable immediately while background reconciliation refreshes both copies.

The cross-session half of that design is what trips the warning. globalState is a key/value store intended for small values — VS Code keeps it in memory and serializes it — so a cached database schema is well outside what it is meant to hold. globalStorageUri is the documented place for payloads of this size.

Impact

Nothing is broken today, and the caching design itself is sound — this is about the storage medium, not the strategy. But it grows with the number of connected clusters and the size of their schemas, so a user with several large clusters will push it further. The observed ~950 KB came from ordinary use.

Reproduction

  1. Launch the Extension Development Host and connect to any cluster so schema is fetched.
  2. Watch the extension host log.
  3. The mainThreadStorage warning appears and recurs as schema is written back.

Notes

  • Pre-existing and unrelated to any PR currently open. Observed on branches for #146 and #148 alike, and it comes from schema caching that predates both.
  • Surfaced while testing those PRs in a live Extension Development Host, so filing it rather than losing the observation.
  • A fix would move the persisted schema payload to globalStorageUri while keeping the two-level cache behavior intact — including migrating or discarding whatever is already in globalState so the warning actually stops.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ARCHITECTURE.md and trace the kusto/getData and kusto/setData bridge through SchemaManager and VS Code globalState. Identify how the schema payload is persisted across sessions, then use globalStorageUri while preserving the in-memory and cross-session cache behavior. Done means existing globalState data is migrated or discarded and the large-extension-state warning no longer recurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.