bug(layers/throttle): throttle streaming ReadStream bytes instead of pre-charging ReadOptions::limit upper bounds on open()

Abierto
#9,567 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Xuanwo ya está trabajando en esto.

Desde el 4/12/2026.

  • #9638 de @Xuanwo — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
rust

Línea de trabajo

Start with core/layers/throttle/src/lib.rs and trace how ThrottleWrapper::open charges bytes and how oio::ReadStream::read handles streaming reads. Read core/core/src/raw/oio/read/api.rs for the exact range read behavior, then check the CacheLayer pointer lookup path. Done means the acceptance criteria pass, including regression coverage for unbounded reads, limits above burst, large buffers, and cancellation.

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

Descripción

bug core
Background

Re-evaluating #7453 in light of newly added ReadOptions::limit and CacheLayer:

  • In core/layers/throttle/src/lib.rs:137-154,266-296, ThrottleWrapper::open pre-charges range.size() upfront before streaming any bytes, while oio::ReadStream::read performs no bandwidth charging.
  • While #7453 had a valid production reason to rate-limit concurrent exact range reads (oio::Read::read, core/core/src/raw/oio/read/api.rs:38) before dispatching requests to prevent request/FD spikes, streaming open(range) allows short EOF and now carries defensive upper bounds via ReadOptions::limit:
    1. Unbounded reads (op.read("10gb"), range = 0..) bypass ThrottleLayer completely (range.size() == None).
    2. Defensive bounded reads (op.read_with("10_bytes").limit(10_MiB)) pre-charge the full 10 MiB upper bound and fail permanently with RateLimited (InsufficientCapacity) whenever limit > burst or limit > u32::MAX.
    3. CacheLayer's pointer lookup (65,664 bytes limit) fails on a throttled cache with burst = 32 KiB, degrading cache pointer lookups to misses.
Proposed Solution
  • Preserve pre-admission rate limiting where exact-length range reads require it, and define a clear policy for requests larger than burst (e.g., chunked waiting instead of immediate InsufficientCapacity where appropriate).
  • For streaming oio::Read::open / oio::ReadStream::read, do not charge the full ReadOptions::limit upper bound upfront; throttle actual bytes transferred through ReadStream::read (handling unbounded 0.. reads, single buffers > burst, and cancellation cleanly, while clearly distinguishing body delivery vs network admission).
Acceptance Criteria
  • Streaming open(0..) reads are throttled by ThrottleLayer rather than bypassing it.
  • Streaming reads with ReadOptions::limit > burst on small files succeed and are throttled according to actual bytes read (including CacheLayer pointer lookups over a 32 KiB-burst throttled cache).
  • Add regression tests covering unbounded 0.. reads, limit > burst, single buffer > burst, and cancellation.

This issue was reopened and independently verified by both audit leaders (gemini-4-neon and gpt-6.2-astra) ahead of Apache OpenDAL v0.60.0.

Lenguaje dominante
Rust
Estrellas
5.5k
Forks
869
Merge medio
8 h 2 min
PR fusionados (30 d)
862

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 apache/opendal

Todos los issues de apache/opendal

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.