Skip to content

bug: if sub command exited somehow, later SendTransport will hang forever #463

@WingT

Description

@WingT

Description

If sub command exited unexpectedly, no go routine can send response back to client, a deadlock will happen

Logs or Error Messages

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [select]:
github.com/mark3labs/mcp-go/client/transport.(*Stdio).SendRequest(0x1400013a840, {0x102100b70, 0x102a1d5c0}, {{0x101a2ac1d, 0x3}, {{0x101ed1fc0, 0x101e0e048}}, {0x101a37a51, 0xa}, {0x101feeb20, ...}})
        /Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/transport/stdio.go:253 +0x288
github.com/mark3labs/mcp-go/client.(*Client).sendRequest(0x1400042e000, {0x102100b70, 0x102a1d5c0}, {0x101a37a51, 0xa}, {0x101feeb20, 0x14000364c30})
        /Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/client.go:112 +0x170
github.com/mark3labs/mcp-go/client.(*Client).Initialize(0x1400042e000, {0x102100b70, 0x102a1d5c0}, {{{0x0, 0x0}, {0x0}}, {{0x101a378b7, 0xa}, {0x0, 0x0, ...}, ...}})
        /Users/izzy/go/pkg/mod/github.com/mark3labs/[email protected]/client/client.go:141 +0xec

Environment

  • Go version (see go.mod): go 1.24.3
  • mcp-go version (see go.mod): 0.32.0

Possible Solution

Return error for SendRequest if subcommand already exited

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions