Generated Reqwest clients should use a shorter idle connection pool timeout

Abierto
#1,444 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
tooling

Línea de trabajo

Start by locating the generator code and tests for generated native Client::new constructors, then review the linked Dropshot discussion for context on the timeout tradeoff. Update generator tests and generated-code snapshots to verify the chosen pool_idle_timeout is emitted only for native Client::new; confirm new_with_client and wasm32 output remain unchanged, then compile generated clients. Done when those checks pass, though the appropriate default still needs a decision.

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

Descripción

Problem

Progenitor-generated native clients currently construct their default reqwest::Client without configuring pool_idle_timeout, leaving Reqwest's default of 90 seconds.

This can interact poorly with HTTP servers that close idle connections sooner. For example, Dropshot's underlying Hyper server uses a nominal 30-second keep-alive timeout.

A generated client may attempt to reuse an idle connection around the time the server closes it, resulting in intermittent request failures.

This behavior is discussed in oxidecomputer/dropshot#1739.

Proposed change

Consider setting a shorter pool_idle_timeout in the generated native Client::new constructor.

A value of 15 or 20 seconds has been suggested in the Dropshot discussion. An existing workaround in the scrimlet reconcilers reportedly uses 10 seconds.

The appropriate default should balance reducing connection reuse races against the additional connection churn caused by shorter idle lifetimes.

Scope

  • Apply the setting to generated native Client::new constructors.
  • Preserve Client::new_with_client, allowing callers to supply their own Reqwest configuration.
  • Leave wasm32 behavior unchanged.
  • Do not change request execution timeouts or public constructor signatures.

Testing

The change could be validated through generator tests and updated generated-code snapshots, followed by compilation of the generated clients.

These tests would establish that the intended configuration is emitted, but would not prove that every connection-close race is eliminated.

Open question

What default idle timeout should Progenitor use for generated native clients, considering that they may communicate with both Dropshot and non-Dropshot servers?

@davepacheco @ahl

Related: oxidecomputer/dropshot#1739

Lenguaje dominante
Rust
Estrellas
1k
Forks
142
Merge medio
19 h 13 min
PR fusionados (30 d)
16

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

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 oxidecomputer/progenitor

Todos los issues de oxidecomputer/progenitor

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.