Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#1,563 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
68/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
dart, flutter
Domínio
backend, desktop

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
Dart
Estrelas
23
Forks
1
Merge médio
31min
PRs com merge (30d)
570

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de QueryaHub/Querya-Desktop

Todas as issues de QueryaHub/Querya-Desktop

Issues semelhantes

Mais issues de Dart

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.