api: enforce Connect stream lifecycle policies - #5508
Conversation
Keep handler registration, health and reflection names, and bounded procedure instrumentation derived from one catalog so new services cannot drift across separate allowlists. Signed-off-by: Siavash Safi <siavash@cloudflare.com>
a934601 to
c38131d
Compare
Move RPC admission ahead of decoding, apply explicit unary read and protobuf size limits, and expose bounded lifecycle metrics so slow or oversized clients cannot consume unbounded resources. Signed-off-by: Siavash Safi <siavash@cloudflare.com>
c38131d to
066fff4
Compare
Bound stream idle time and lifetime, track active RPC cancellation, and cancel long-lived handlers during shutdown so every admission slot is eventually released. Signed-off-by: Siavash Safi <siavash@cloudflare.com>
066fff4 to
774f1a1
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (12)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe Connect API now supports configurable concurrency, timeouts, message-size limits, metrics, exact procedure matching, and shutdown cancellation. Application flags and options expose these settings, and tests cover unary, stream, metric, and shutdown behavior. ChangesConnect RPC lifecycle
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🟡 Moderate · up to The PR adds shared stream admission limits and optional idle/lifetime expiration, but production defaults leave both expirations disabled. A reachable client can occupy all stream slots indefinitely, causing ResourceExhausted responses for other Connect users; merge should wait for finite defaults or explicit owner acceptance. Sequence Diagram(s)sequenceDiagram
participant HTTPServer
participant ConnectAPI
participant ConnectControlHandler
participant PrometheusMetrics
HTTPServer->>ConnectAPI: invoke Shutdown()
ConnectAPI->>ConnectControlHandler: reject new RPCs and cancel active RPCs
ConnectControlHandler->>PrometheusMetrics: record terminal RPC outcomes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description accurately summarizes the primary change and references issue Resolution Complete the repository description template. Add the checklist responses, include the applicable unit/e2e test and performance information, state whether the change is breaking, confirm documentation and commit sign-off, and add a release-notes entry or
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bound stream idle time and lifetime, track active RPC cancellation, and cancel long-lived handlers during shutdown so every admission slot is eventually released.
Part of #5478