Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

sdk-http-vertx: response writes ignore Vert.x backpressure

Abierto
#614 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
api, backend

Línea de trabajo

Comienza con HttpResponseFlowAdapter.onSubscribe y onNext, y luego compara el contrato de backpressure de Vert.x WriteStream con su helper Pump. Limita la producción de respuestas, pausa las solicitudes cuando writeQueueFull() sea true y reanúdalas mediante drainHandler; revisa HttpRequestFlowAdapter.handleIncomingBuffer para comprobar el límite correspondiente de la cola.

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

Descripción

Problem

HttpResponseFlowAdapter in sdk-http-vertx ignores Vert.x's write-side backpressure on the HTTP/2 response stream:

  • onSubscribe pulls unboundedly:
    this.outputSubscription = subscription;
    this.outputSubscription.request(Long.MAX_VALUE);
    
  • onNext writes each slice unconditionally:
    this.httpServerResponse.write(
        Buffer.buffer(Unpooled.wrappedBuffer(slice.asReadOnlyByteBuffer())));
    
    No check on HttpServerResponse.writeQueueFull(), no drainHandler(...) to resume.

The Reactive-Streams contract and Vert.x's own WriteStream docs both expect callers to throttle production when writeQueueFull() returns true. The adapter throws away that signal.

Observed evidence

While investigating a separate e2e issue, instrumentation on the SDK side recorded writeQueueFull=true on the very first response writes under a 50-concurrent ctx.run × 10×64 KiB workload (Restate runtime as the peer). That confirms the writeQueue does cross Vert.x's high-watermark threshold in realistic Restate workloads — the adapter just keeps writing past it.

(We did not observe SDK-side heap growth or autoRead toggling in that test, so this issue is a code-correctness / future-proofing fix rather than the cause of the failure we were chasing.)

Proposal

Apply standard Reactive-Streams + Vert.x backpressure to HttpResponseFlowAdapter:

  • Replace request(Long.MAX_VALUE) with a bounded initial request (e.g. request(N)).
  • In onNext, after writing, check httpServerResponse.writeQueueFull():
    • If full, do not call subscription.request(...); instead install httpServerResponse.drainHandler(v -> subscription.request(M)) to resume.
    • If not full, request the next batch immediately.
  • This is the same pattern Vert.x's own Pump helper implements.

Companion (lower priority, same class of bug)

The request side has an analogous unbounded enqueue: HttpRequestFlowAdapter.handleIncomingBuffer pushes incoming buffers into an ArrayDeque<ByteBuffer> without an upper bound. Worth bounding while we're in the same module.

Files

  • sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpResponseFlowAdapter.java
  • sdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java (companion)
Lenguaje dominante
Java
Estrellas
60
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

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 restatedev/sdk-java

Todos los issues de restatedev/sdk-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.