sdk-http-vertx: response writes ignore Vert.x backpressure
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Bắt đầu với HttpResponseFlowAdapter.onSubscribe và onNext, sau đó so sánh contract backpressure của Vert.x WriteStream với helper Pump của nó. Giới hạn việc tạo response, tạm dừng các request khi writeQueueFull() là true và tiếp tục chúng thông qua drainHandler; xem xét HttpRequestFlowAdapter.handleIncomingBuffer để kiểm tra giới hạn queue tương ứng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- Java
- Star
- 60
- Fork
- 17
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của restatedev/sdk-java
-
Vert.x 5 update Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
restatedev/sdk-java#629 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
restatedev/sdk-java#603 ·
-
Reflection based experience Đang mở
restatedev/sdk-java#570 · 1 người được giao ·
-
Java jackson 3 version upgrade Đang mởdependencies
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
restatedev/sdk-java#569 · 2 bình luận · 1 reaction ·
-
Spring boot Servlet integration Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
restatedev/sdk-java#555 · 1 bình luận ·
Tất cả issue của restatedev/sdk-java
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
inu-appcenter/memorIN-backend#288 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
frontend maui-pilot pilot-ask question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Đang mởarea/plugin
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
kestra-io/plugin-kestra#190 ·