SchemaStore.dispose() writes to an already-disposed output channel: "Channel has been closed" on every shutdown
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- tooling
Direzione di ricerca
Inizia dal percorso di attivazione dell’estensione, dove ext.outputChannel e SchemaStore.getInstance() vengono aggiunti a context.subscriptions, quindi esamina SchemaStore.dispose() e logStats(). Riproduci il problema attivando l’estensione, chiudendo la finestra di VS Code e controllando il log di exthost; il lavoro è completato quando l’arresto non produce alcun errore "Channel has been closed".
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduced against the CI-built vscode-documentdb-0.10.0.vsix from #883 (artifact of run 31513450303).
Summary
Every extension-host shutdown logs an unhandled error while disposing the extension's subscriptions. SchemaStore.dispose() calls logStats(), which writes to the shared output channel — but that channel has already been disposed by then, so the write throws.
[error] An error occurred when disposing the subscriptions for extension 'ms-azuretools.vscode-documentdb':
[error] Error: Channel has been closed
at AzExtLogOutputChannel.appendLine (main.js:2:362407)
at AzExtLogOutputChannel.appendLog (main.js:2:362726)
at SchemaStore.logStats (main.js:2:2120687)
at SchemaStore.dispose (main.js:2:2123726)
Observed in 4 of 6 windows that reached a clean shutdown. It is the only extension-level error in any of those runs — everything else is clean.
Cause
The ordering is deterministic, not a race. activate() registers the output channel into context.subscriptions before it registers SchemaStore:
ext.outputChannel -> subscriptions[i]
…
SchemaStore.getInstance() -> subscriptions[j] where j > i
VS Code disposes context.subscriptions in registration order, so the channel at i is closed before SchemaStore at j runs its own dispose(). logStats() then writes to a closed channel.
Worth noting the ext.outputChannel?. optional chaining in that path reads as a guard but isn't one — the object still exists, it is merely closed, so ?. passes and appendLine throws.
Steps to reproduce
- Install
vscode-documentdb-0.10.0.vsix. - Open a window and let the extension activate.
- Close the window.
- Check
logs/<session>/window1/exthost/exthost.log.
Expected: shutdown completes without errors.
Actual: the stack above, on most shutdowns.
Impact
Not user-visible — it is log noise at shutdown, and no functionality is lost. Two reasons it is still worth fixing:
- It fires on every window close, reload, and extension update, so it is persistent noise in any log a user attaches to a bug report.
- VS Code aborts the remainder of that subscription-disposal pass when a disposable throws, so a genuine cleanup failure registered after
SchemaStorecould be masked by this one.
Suggested fix
Any of:
- Register
SchemaStorebeforeext.outputChannelso it disposes first; or - Have
logStats()bail when the channel is closed (track a disposed flag rather than relying on?.); or - Move the stats logging out of
dispose()entirely — emitting telemetry at shutdown is fine, but writing to a channel that is itself a subscription is inherently order-dependent.
The first is the smallest change; the second is the most robust if anything else ever logs during disposal.
Suggested milestone
0.10.1 — not a release blocker for 0.10.0 unless the reorder turns out to be a confident one-liner.
- Lingua principale
- TypeScript
- Stelle
- 33
- Fork
- 22
- Merge medio
- 18h 6m
- PR unite (30g)
- 41
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- 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 microsoft/vscode-documentdb
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
microsoft/vscode-documentdb#956 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/vscode-documentdb#934 ·
I maintainer di solito rispondono entro 1 giorno
-
bug-bash
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/vscode-documentdb#875 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/vscode-documentdb#831 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Revisit: getMongoClient() JSDoc is misleading; only used by main thread scanCollectionSchemaForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertadocumentation needs-triage P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
microsoft/vscode-documentdb#643 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/vscode-documentdb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
umbraco/Umbraco-CMS-MCP-Dev#512 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
wimpysworld/sidra#290 ·
I maintainer di solito rispondono entro 1 giorno
-
defuFn invokes function values for inherited default propertiesForse già presa @xiehuanyi l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
feature request good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
TabularisDB/tabularis#853 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 85/100
capricorn86/happy-dom#2474 ·
I maintainer di solito rispondono entro 2 giorni