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

StdioClientTransport: Inbound Scheduler and Error Scheduler threads are locked on Windows

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

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại io.modelcontextprotocol.client.transport.StdioClientTransport, tập trung vào Inbound Scheduler, Error Scheduler và phương thức closeGracefully, sau đó xem xét thread dump Windows đính kèm để tìm các thao tác đọc bị chặn. Tái hiện Spring AI Filesystem Demo trên Windows và xác minh rằng quá trình shutdown kết thúc tiến trình Java mà không để các scheduler thread bị khóa.

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

Mô tả

bug P2

Bug description
Two threads, Inbound Scheduler and Error Scheduler, remain locked forever (at java.io.FileInputStream.readBytes native call) in io.modelcontextprotocol.client.transport.StdioClientTransport after the graceful shutdown is completed using closeGracefully method.

Looks like a Windows specific issue with native I/O calls. The problem is observed when running on Windows. No problems with Linux environment.

The thread dump is attached.
dump_jdk17.txt
See "pool-2-thread-1" and "pool-5-thread-1" dumps.

Environment
Windows 11 Enterprise
mcp-core 0.17.1
Spring AI 2.0.0-SNAPSHOT
JDK Temurin 17.0.14 (also tried Amazon Corretto 21.0.5)

Linux Behavior
Works fine under Ubuntu 24.04 and JDK Temurin 21.0.10

Steps to reproduce

Expected behavior
The Java process terminates after running the Spring AI Filesystem Demo example.

Possible solution
On Windows, use daemon threads for inbound and error schedulers

private ThreadFactory daemonThreadFactory = runnable -> {
		Thread t = new Thread(runnable);
		t.setDaemon(true);
		return t;
	};
if (isWindows) {
    this.inboundScheduler = Schedulers.fromExecutorService(Executors.newSingleThreadExecutor(daemonThreadFactory), "inbound");
    this.errorScheduler = Schedulers.fromExecutorService(Executors.newSingleThreadExecutor(daemonThreadFactory), "error");
}

Tried this solution locally. It resolves the termination issue. But the graceful shutdown logic in io.modelcontextprotocol.client.transport.StdioClientTransport#closeGracefully should be revised as well.

Ngôn ngữ chính
Java
Star
3.7k
Fork
1.1k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 modelcontextprotocol/java-sdk

Tất cả issue của modelcontextprotocol/java-sdk

Issue tương tự

Thêm issue về Java

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.