Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

fix(mcp): McpServerController.start/stop race creates a second socket host and leaks the first

Aperta
#1,563 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter
Ambito
backend, desktop

Direzione di ricerca

Start with lib/core/mcp/mcp_server_controller.dart:102-124 and trace how start() and stop() handle overlapping calls and the host.changes subscription. Add tests for two concurrent start() calls creating one host and for stop() during startup ending in a stopped state; done when both behaviors pass and the subscription is cancelled on stop.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug core P2 stability

Problem

McpServerController.start() (lib/core/mcp/mcp_server_controller.dart:102-124) checks _host != null first, then awaits _version() and host.start(), and assigns _host only after that. Two overlapping calls (startIfEnabled + setEnabled(true), repeated toggle, regenerateToken) create two McpSocketHosts: the first is leaked (never stopped), both write the same endpoint file and the token in the file may not belong to the host that is tracked.

stop() during an in-flight start() sees _host == null, does nothing, and the server comes up afterwards while the setting says disabled.

host.changes.listen is also never cancelled.

Expected

  • Serialize start / stop (single in-flight future or a lock) and assign _host before the first await.
  • Cancel the changes subscription on stop.
  • Test: concurrent start() x2 yields one host; stop() during start() ends stopped.
Lingua principale
Dart
Stelle
23
Fork
1
Merge medio
31m
PR unite (30g)
570

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QueryaHub/Querya-Desktop

Tutte le issue di QueryaHub/Querya-Desktop

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.