Skip to content

Keep the default timeouts on API requests - #318

Merged
uwolfer merged 1 commit into
masterfrom
ccr-f803d45a-request-timeouts
Oct 7, 2026
Merged

uwolfer merged 1 commit into
masterfrom
ccr-f803d45a-request-timeouts

Conversation

@uwolfer

@uwolfer uwolfer commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Problem

GerritHttpClientFactory gives each client a default RequestConfig with 5-minute connect, socket (read) and connection-request timeouts.

GerritRestClient then sets a config of its own on every API request to turn off URI normalization (b8bdea0, "Disable implicit URL normalization"). A config set on the request replaces the client's default config as a whole. Because that one was built with RequestConfig.custom(), every API request ran with all three timeouts unset. A request to a server that accepts the connection and never answers waits forever.

Requests sent without a config of their own, i.e. the session check and the login ahead of an API request, kept the default timeouts.

It also shows up through HttpClientBuilderExtensions. gerrit-intellij-plugin sets only a connect timeout through an extension. On HTTPS, the socket factory makes the connect timeout the socket's read timeout for the handshake, and with the socket timeout left unset nothing replaces it afterwards. So every HTTPS read was cut off after the connect timeout (uwolfer/gerrit-intellij-plugin#718 works around this on the plugin side).

Change

The request's config now starts from the client's default config (RequestConfig.copy(...)) and only turns off URI normalization, so API requests keep the 5-minute timeouts.

Testing

  • New GerritRestClientTest#testRequestKeepsDefaultTimeouts: an extension records the config each request goes out with.
    • Without the fix it fails: the connect timeout comes back unset instead of 300000.
    • With the fix it passes.
  • mvn test: 547 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DeS4NogitfTa3EDcB8k6a3


Generated by Claude Code

@coveralls

coveralls commented Oct 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 96.472% (+0.09%) from 96.386% — ccr-f803d45a-request-timeouts into master

The config set on each API request to turn off URI normalization
replaces the client's default config as a whole, and was built from
scratch: it dropped the five-minute connect, read and connection
request timeouts, so a request to a server which never answers waited
for good. It now starts from the default config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DeS4NogitfTa3EDcB8k6a3
@uwolfer
uwolfer force-pushed the ccr-f803d45a-request-timeouts branch from eb1006d to 3ee69e5 Compare October 7, 2026 21:02
@sonarqubecloud

sonarqubecloud Bot commented Oct 7, 2026

Copy link
Copy Markdown

@uwolfer
uwolfer merged commit 89011b9 into master Oct 7, 2026
4 of 5 checks passed
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.

3 participants