Repository navigation
[ID-1671] Handle incomplete upstream responses without returning partial success - #14
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe forwarder now resets buffered responses after upstream body-read failures, retries eligible candidates, and retains abort behavior for streamed responses. Capture and WebSocket buffers support resets. RPC tests cover truncation, cancellation, retries, metrics, caching, and recovery. EVM batch handling converts captured non-2xx responses into JSON-RPC errors. ChangesUpstream response truncation handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to This change makes incomplete upstream responses retry or return a 502 instead of a partial success, and aborts truncated streams. No merge-blocking risk was identified from the supplied evidence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Large historical responses could hit an upstream EOF or timeout after Stitch had buffered only part of the body. Stitch then flushed that partial body as a clean HTTP 200, and a syntactically valid prefix could enter a response or hash cache.
Discard failed buffered attempts and use the existing coverage, retry-budget and idempotency rules to retry or return a complete 502. Abort already committed HTTP streams on a failed upstream read. Preserve Comet WebSocket connections, EVM batch request IDs and structured errors, and prevent failed filter creation from leaving bindings. Count only the final buffered request outcome in traffic metrics; client cancellations release half-open circuit slots without penalizing the backend.
Validation: full
go test -race -count=1 -timeout=10m ./...,go vet ./...,go build -mod=readonly ./..., and golangci-lint v2.12.2 passed. Real HTTP listener regressions cover premature EOF, broken chunks, body deadlines, HTTP/1 and HTTP/2 aborts, slow complete responses, cache poisoning, batch errors, filter creation and cancellation. Independent review found no remaining issues.The published candidate passed RPC/API/gRPC/EVM checks, two real 30-second timeout cases with complete 502 responses and no cache poisoning, and successful cache recovery. Stable v0.1.10 has been deployed to both OVH archival replicas. Both replicas and the public endpoint now return complete 502 JSON for the slow historical request, with matching runtime deadline logs; none returns truncated HTTP 200. The archive-to-OVH path still has significant TCP loss, so large historical delivery remains unresolved. This change makes those failures explicit and does not claim to fix network throughput.
Linear: https://linear.app/injectivelabs/issue/ID-1671