Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,563 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter
Lĩnh vực
backend, desktop

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Dart
Star
23
Fork
1
Merge trung bình
31 phút
Pull request đã merge (30 ngày)
570

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QueryaHub/Querya-Desktop

Tất cả issue của QueryaHub/Querya-Desktop

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.