Skip to content

dial tcp 127.0.0.1:10088: connect: can't assign requested address #1714

@spacewander

Description

@spacewander

Description:

Describe the issue.

When I do a benchmark for ai-gateway with the default configuration, after a while, there will be lots of errors:

msg="failed to create MCP session" component=mcp-proxy backend=rust-upstream error="failed to send MCP initialize request: failed to send MCP notifications/initialized request: Post \"http://127.0.0.1:10088/mcp\": dial tcp 127.0.0.1:10088: connect: can't assign requested address"

My benchmark script is:

import http from 'k6/http';

export const options = {
  vus: 100, // Max virtual users (equivalent to 100 connections in wrk)
  duration: '30s', // Test duration
};

const url = 'http://localhost:1975/mcp';

const headers = {
  Accept: 'application/json, text/event-stream',
  'Content-Type': 'application/json',
};

const body = JSON.stringify({
  method: 'initialize',
  params: {
    protocolVersion: '2025-06-18',
    capabilities: {},
    clientInfo: {
      name: 'example-client',
      version: '1.0.0',
    },
  },
  jsonrpc: '2.0',
  id: 0,
});

export default function () {
  http.post(url, body, { headers });
}

The ai-gateway is started by aigw run --mcp-config envoy-ai-gateway/mcp-servers.json

The 10088 port is listened to by the internal MCP backend.
Is the :1975 to :10088 traffic using short-lived connections?

Any extra documentation required to understand the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions