Skip to content

<fix>[core]: cap client keep-alive below agent socket timeout#4598

Open
MatheMatrix wants to merge 1 commit into
5.4.12from
sync/moyu/ZSTAC-86783
Open

<fix>[core]: cap client keep-alive below agent socket timeout#4598
MatheMatrix wants to merge 1 commit into
5.4.12from
sync/moyu/ZSTAC-86783

Conversation

@MatheMatrix

Copy link
Copy Markdown
Owner

Backport to 5.4.12.

  • Jira: ZSTAC-86783, original: ZSTAC-86545 (TIC-5970)
  • Cherry-pick of zstack!10364 (5.5.28); one conflict in RESTFacadeImpl.java resolved by dropping unrelated 5.5.x buildBaseUrl/buildCallbackUrl IPv6 helper context — only the fix logic kept
  • RESTFacadeImpl: set ConnectionKeepAliveStrategy on the async HttpAsyncClient, capping client connection reuse lifetime below agent cherrypy socket_timeout via new global property RESTFacade.keepAliveTimeMillis (default 5000ms), so the client always recycles idle connections before the agent closes them — eliminates "Connection reset by peer" (error 1015) on reused dead connections
  • GlobalPropertyImpact: adds RESTFacade.keepAliveTimeMillis (default 5000)
    • RestFacadeKeepAliveCase groovy case

Verification on 5.4.12 + this fix:

  • Full ./runMavenProfile premium: BUILD SUCCESS, 140/140 modules
  • RestFacadeKeepAliveCase: Tests run: 1, Failures: 0, Errors: 0 (77s)
  • RestFacadeCase (regression): Tests run: 1, Failures: 0, Errors: 0 (87s)
  • Original fix QA-verified on 5.5.28 (packet-capture confirmed client FIN before agent timeout, 0 RST)

sync from gitlab !10570

MN's async RESTFacade HTTP client (Apache HttpAsyncClient) never set a
keep-alive strategy, so idle connections in the pool live forever: the
default strategy returns -1 when the agent sends no Keep-Alive header.
The agent cherrypy HTTP server closes idle keep-alive connections at its
socket_timeout (10s default, 15s after the agent-side fix). When the pool
reuses a connection the agent has already closed, the reused request hits
a RST and surfaces as "Connection reset by peer" wrapped in error 1015
"Cannot make a HTTP request", intermittently disconnecting hosts.

Cap the client keep-alive duration via a new global property
RESTFacade.keepAliveTimeMillis (default 5000ms, below the agent
socket_timeout) so the client always recycles an idle connection before
the agent closes it.

GlobalPropertyImpact: adds RESTFacade.keepAliveTimeMillis (default 5000)
Cherry-pick of zstack!10364 from 5.5.28 to 5.4.12 (conflict in
RESTFacadeImpl.java: dropped unrelated 5.5.x buildBaseUrl/buildCallbackUrl
IPv6 helper context, kept only the fix).

Resolves: ZSTAC-86783
Related: ZSTAC-86545

Change-Id: I776d707461676d667063786b6679646c70687a64
(cherry picked from commit abe313c)
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7d3ae28c-0a6a-46e8-87f4-1cbf956565d5

📥 Commits

Reviewing files that changed from the base of the PR and between 53153f1 and d40ce2d.

📒 Files selected for processing (3)
  • core/src/main/java/org/zstack/core/CoreGlobalProperty.java
  • core/src/main/java/org/zstack/core/rest/RESTFacadeImpl.java
  • test/src/test/groovy/org/zstack/test/integration/core/rest/RestFacadeKeepAliveCase.groovy

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Could not fetch remote config from http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml: TimeoutError: The operation was aborted due to timeout
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sync/moyu/ZSTAC-86783

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant