[Bug]: Rapid tab switching stalls for 1.3-1.6s — redundant per-switch DB reloads serialize on the single-connection store
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- backend, cli, performance
Direzione di ricerca
Start with reinitWave and WorkspaceService.SetActiveTab, then compare the two linked fork commits to understand the reduced reloads, removed return-value reads, and cache-resync tradeoff. Reproduce rapid switching on Windows and profile SetActiveTab; done means no queued per-switch reload spikes and switching remains near the reported low-millisecond results.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Current Behavior
Switching tabs quickly (clicking through 3+ tabs, or holding the switch-tab shortcut) intermittently freezes the UI for 1.3–1.6 seconds. Single, slow-paced switches feel fine; the stall appears once switches come in quick succession, and it gets worse with more tabs/blocks in the workspace. Observed on Windows; the mechanism below is platform-independent, but slower disk I/O (NTFS + Defender) makes it much more visible there.
Expected Behavior
Tab switching stays in the low-milliseconds range regardless of how fast you switch or how many tabs the workspace has.
Steps To Reproduce
- Windows 11, Wave with one workspace containing ~5+ tabs, each with a few terminal blocks
- Rapidly switch between tabs (click tabs in quick succession or repeat the tab-switch keybinding)
- UI stalls for over a second; profiling the backend shows
SetActiveTabspiking to ~1.5s
Wave Version
v0.14.5 (also reproduced on recent main)
Platform
Windows
OS Version/Distribution
Windows 11
Architecture
x64
Anything else?
I profiled this and the cost is not the WebContentsView swap (setBounds is ~0.1ms) — it's a flood of DB operations triggered on every switch, all serialized on the single-connection store:
reinitWavereloads everything on each switch: client, window, workspace, the switched-to tab, its layout, plus every other tab in the workspace — N+5 DB reads per switch. These are almost entirely redundant: the tab's webContents stays alive off-screen with live WPS subscriptions, so its cache is already fresh.WorkspaceService.SetActiveTabreads the tab and all of its blocks to build a return value that no caller consumes (the frontend signature is alreadyPromise<void>).
Under rapid switching these reads queue up on the store and everything behind them waits.
Measured results after fixing both (reloading only the switched-to tab + layout as a safety net, and dropping the unused return-value reads):
SetActiveTabbackend time: max 1576ms → ~20ms (zero spikes >100ms)- Switch median: 16ms → 6.4ms
Working fix in my fork:
- https://github.com/freefrank/waveterm/commit/9a8d0eeda5eb13f2ba683fcbd2967e7ea6e9450a (the core change)
- https://github.com/freefrank/waveterm/commit/71ea570f48533bd886f488c7ee6f8375af85f30d (follow-up: keeps the post-switch
globalRefocus(), and adds a throttled background resync of client/window/workspace/tabs so a websocket reconnect while a tab is hidden can't leave its cache permanently stale)
Two design points worth flagging if you want this upstreamed:
- The follow-up uses a 30s-throttled background resync as the stale-cache safety net; an alternative (arguably cleaner) is resync-on-reconnect in
wos.ts, which didn't exist as a hook when I wrote this. - Removing
SetActiveTab's return value is a service-contract change; I verified the only caller discards it, but calling it out explicitly.
Happy to open a PR with the fix if this direction works for you.
- Lingua principale
- Go
- Stelle
- 22.7k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wavetermdev/waveterm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
wavetermdev/waveterm#3601 ·
I maintainer di solito rispondono entro 1 giorno
-
bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
wavetermdev/waveterm#3596 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `wsh termscrollback` returns zero lines for valid ranges starting at line 0Forse già presa @bardrop l’ha presa 6 giorni fa. Apertabug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
wavetermdev/waveterm#3587 ·
I maintainer di solito rispondono entro 1 giorno
-
bug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
wavetermdev/waveterm#3568 ·
I maintainer di solito rispondono entro 1 giorno
-
pwsh: encodeEnvVarsForPowerShell rejects Windows-standard env var names like ProgramFiles(x86), breaking wsh token on every pwsh blockForse già presa @vortsghost2025 l’ha presa 72 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
wavetermdev/waveterm#3481 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wavetermdev/waveterm
Issue simili
-
good first issue help wanted javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
fullsend-ai/fullsend#9733 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
karmada-io/karmada#8101 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno