Flake: MCP handshake cancellation can outlive authorization send deadline

Abierto
#2,908 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@jbeda ya está trabajando en esto.

Desde el 20/11/2026.

  • #2910 de @jbeda — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
go

Línea de trabajo

Start with internal/adapter/mcp/gatewaycall_test.go:351–370 and reproduce the failure with the focused go test -race command in the issue. Then read internal/adapter/mcp/gatewaycall.go:183–199 and :300–375 to trace deadline propagation and SDK connection cleanup. Done means the handshake terminates promptly after the authorization deadline, cleanup leaves no leaked goroutines or resources, and a deterministic test covers the failing interleaving.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Failure

TestSendGatewayCallHandshakeEndsAtSendBy intermittently fails under -race:

--- FAIL: TestSendGatewayCallHandshakeEndsAtSendBy (5.08s)
    gatewaycall_test.go:370: a hung handshake outlived the authorization's send deadline

Observed in PR #2906, CI race job.

Investigation

This is pre-existing, not caused by module-publication metadata adoption:

  • Focused race repetitions reproduced the same timeout at both adoption head f37258f71e24c867b5920f04b3db2d7ee337cefe and baseline e5a72977e37c65483de32cf6c6665526a62f6528.
  • Across the investigation's focused batches: adoption failed 1/1,600 repetitions; baseline failed 11/3,000. Some batches overlapped or used profiling, so these are reproduction counts, not comparable failure-rate estimates.
  • MCP code, root go.sum, and all 666 resolved external module/version selections were unchanged. Root's local module replacements remain in place; the MCP SDK remains v1.8.0.
  • No WARNING: DATA RACE appeared. A race-enabled test failure is not itself a detected data race.

Example focused reproduction (Go 1.27.3, Linux amd64; dependencies already cached):

GOWORK=off GOPROXY=off go test -mod=readonly -race \
  ./internal/adapter/mcp \
  -run '^TestSendGatewayCallHandshakeEndsAtSendBy$' \
  -count=1000 -timeout=240s

The failure is intermittent; a passing batch does not rule it out.

Relevant paths

  • internal/adapter/mcp/gatewaycall_test.go:351–370: fake transport waits on request cancellation; test sets a 50ms authorization deadline and fails if the overall call has not returned within five seconds.
  • internal/adapter/mcp/gatewaycall.go:183–199: deadline-bound SDK connection and failed-handshake cleanup.
  • internal/adapter/mcp/gatewaycall.go:300–375: wire/request-context handling.

The evidence points toward an intermittent handshake cancellation/teardown interaction; the exact blocking interleaving is not established. Investigate context propagation and SDK connection cleanup rather than simply increasing the timeout or weakening the authorization-deadline assertion.

Expected outcome

A hung handshake terminates promptly when the authorization send deadline expires, with cleanup completing and no leaked goroutines/resources. Preserve the deadline/security contract and cover the failing interleaving with deterministic synchronization where possible.

Lenguaje dominante
Go
Estrellas
309
Forks
29
Merge medio
15 h 56 min
PR fusionados (30 d)
225

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stacklok/mecatl

Todos los issues de stacklok/mecatl

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.