sdk-http-vertx: response writes ignore Vert.x backpressure
还没有人认领这个 Issue。
评估
调研方向
从 HttpResponseFlowAdapter.onSubscribe 和 onNext 开始,然后将 Vert.x WriteStream 的背压契约与其 Pump 辅助工具进行比较。限制 response 的生成,当 writeQueueFull() 为 true 时暂停 request,并通过 drainHandler 恢复;检查 HttpRequestFlowAdapter.handleIncomingBuffer 中对应的 queue 上限。
由索引模型根据 Issue 内容生成。
描述
Problem
HttpResponseFlowAdapter in sdk-http-vertx ignores Vert.x's write-side backpressure on the HTTP/2 response stream:
onSubscribepulls unboundedly:this.outputSubscription = subscription; this.outputSubscription.request(Long.MAX_VALUE);onNextwrites each slice unconditionally:
No check onthis.httpServerResponse.write( Buffer.buffer(Unpooled.wrappedBuffer(slice.asReadOnlyByteBuffer())));HttpServerResponse.writeQueueFull(), nodrainHandler(...)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, checkhttpServerResponse.writeQueueFull():- If full, do not call
subscription.request(...); instead installhttpServerResponse.drainHandler(v -> subscription.request(M))to resume. - If not full, request the next batch immediately.
- If full, do not call
- This is the same pattern Vert.x's own
Pumphelper 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.javasdk-http-vertx/src/main/java/dev/restate/sdk/http/vertx/HttpRequestFlowAdapter.java(companion)
- 主要语言
- Java
- 星标
- 60
- 派生
- 17
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
restatedev/sdk-java 的其他 Issue
-
Vert.x 5 update 未关闭
难度 3/5 1-2 天 新手友好度 25/100
restatedev/sdk-java#629 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
restatedev/sdk-java#603 ·
-
restatedev/sdk-java#570 · 已指派 1 人 ·
-
dependencies
难度 3/5 1-2 天 新手友好度 48/100
restatedev/sdk-java#569 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 45/100
restatedev/sdk-java#555 · 1 条评论 ·
查看 restatedev/sdk-java 的全部 Issue
相似的 Issue
-
area/plugin
难度 2/5 1-3 小时 新手友好度 75/100
kestra-io/plugin-kestra#190 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
apache/rocketmq-dashboard#5064 ·