fix: guard duplicate rpc mount paths, reap idle connections#110
fix: guard duplicate rpc mount paths, reap idle connections#110rustatian wants to merge 5 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 58 minutes and 7 seconds. Learn how PR review limits work. Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #110 +/- ##
==========================================
+ Coverage 63.94% 70.80% +6.86%
==========================================
Files 3 3
Lines 147 161 +14
==========================================
+ Hits 94 114 +20
+ Misses 36 32 -4
+ Partials 17 15 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves RPC server robustness by making plugin RPC handler mounting deterministic and safe in the presence of duplicate mount paths, and by reaping idle keep-alive connections via an IdleTimeout.
Changes:
- Build the RPC
http.ServeMuxdeterministically (sorted plugin names) and skip duplicate/invalid mount paths with warnings instead of panicking. - Extract mux construction into
buildMux()and add a unit test covering duplicate/invalid path skipping behavior. - Configure the RPC
http.ServerwithIdleTimeout: 1mto reap idle connections; update test-module dependencies.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
plugin.go |
Adds deterministic mux construction (buildMux()), duplicate mount-path guarding, and sets IdleTimeout on the HTTP server. |
plugin_internal_test.go |
Adds a unit test for buildMux() behavior with duplicate/invalid paths. |
tests/go.mod |
Bumps indirect dependency versions for the tests module. |
tests/go.sum |
Updates checksums corresponding to the dependency bumps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closing: the Connect-RPC server this hardens is being reverted to goridge/net-rpc (see #114). |
buildMux()helper, covered by unit testsServe()with an error naming both plugins — it means the same service is wired twice (build-time bug); previouslyhttp.ServeMux.Handlepanicked the whole process and map iteration made the winner nondeterministicIdleTimeout(1m) on the rpc server so idle h2c keep-alive connections get reaped;WriteTimeoutis deliberately left unset — handlers may block longer than any fixed limit (e.g.lockwaits with a client-chosen wait TTL)