fix: HTTP connection eviction and gRPC keepalive#64
Conversation
- Add evictExpiredConnections and evictIdleConnections(30s) to HttpClient to prevent reuse of stale pooled connections - Configure connection pool sizing (20 total, 10 per route) - Add gRPC keepAliveTime(60s), keepAliveTimeout(10s), and keepAliveWithoutCalls to detect dead channels proactively - Add StaleConnectionTests to replicate connection reset scenarios Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughgRPC channel keepalive enabled (60s/10s, pings without active calls); HTTP client uses a pooled connection manager with eviction of expired/idle connections; project version and Constants.version bumped to 2.1.2. ChangesConnection Resilience
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/scalekit/api/impl/ScalekitAuthClient.java`:
- Around line 57-62: ScalekitAuthClient and ScalekitClient must manage their
pooled resources: make both classes implement AutoCloseable and add a close()
method that explicitly releases their resources — in ScalekitAuthClient call
httpClient.close() and also shut down the underlying connection manager used to
build httpClient (the PoolingHttpClientConnectionManager instance), and in
ScalekitClient keep the created ManagedChannel in a private field (e.g.,
channel) instead of a local variable and in close() call channel.shutdown() (and
await termination or call shutdownNow() as appropriate) to ensure the gRPC
channel is cleaned up; update constructors/fields to store these resources so
close() can access them.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e5e45df9-1e63-445b-860e-62c497f90cd7
📒 Files selected for processing (2)
src/main/java/com/scalekit/ScalekitClient.javasrc/main/java/com/scalekit/api/impl/ScalekitAuthClient.java
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Server does not set permitKeepAliveWithoutCalls=true, so client pings on idle connections would trigger GOAWAY/ENHANCE_YOUR_CALM. Keepalive pings will now only fire during active RPCs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
ScalekitAuthClient: ConfiguredPoolingHttpClientConnectionManagerwith explicit pool sizing (20 total, 10 per route) and addedevictExpiredConnections()+evictIdleConnections(30s)to prevent stale pooled connections from being reused after the server has closed themScalekitClient: Added gRPC keepalive (keepAliveTime=60s,keepAliveTimeout=10s,keepAliveWithoutCalls=true) to proactively detect dead channels before RPCs hit themTest plan
mvn test)🤖 Generated with Claude Code
Summary by CodeRabbit