Skip to content

Retry on CLOSE_NOTIFY_CONNECTION - #2198

Merged
fool1280 merged 2 commits into
masterfrom
fool1280/retry-on-close-notify
Jul 27, 2026
Merged

Retry on CLOSE_NOTIFY_CONNECTION#2198
fool1280 merged 2 commits into
masterfrom
fool1280/retry-on-close-notify

Conversation

@fool1280

Copy link
Copy Markdown
Contributor

Zuul was not retrying requests that failed with CLOSE_NOTIFY_CONNECTION because most close_notifies came from malformed requests, but Zuul now validates headers upstream, so the remaining cases are safe to retry.

This change adds CLOSE_NOTIFY_CONNECTION to isRetryable, gated on idempotent methods (GET/HEAD/OPTIONS) so a POST the origin may have already processed is never replayed. The retry logic is refactored into two intent-named branches (connection failures retry for any method; ambiguous failures retry idempotent methods only), and the duplicated idempotency check is pulled into a shared isIdempotentRequest helper. Adds unit tests covering GET vs POST on close_notify, plus a regression guard that RESET_CONNECTION/CONNECT_ERROR stay retryable for all methods.

void connectionErrorsRetriedForAnyMethod() {
// Regression guard: RESET_CONNECTION and CONNECT_ERROR must stay retryable for all methods,
// including a non-idempotent (POST) request. A '&&' instead of '||' here would make the
// condition impossible and silently disable connection-failure retries.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove these comments

assertThat(proxyEndpoint.isRetryable(OutboundErrorType.CLOSE_NOTIFY_CONNECTION))
.isFalse();

// GET (idempotent): safe to replay on a fresh connection -> must retry.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: these test comments aren't really useful


// Ambiguous failures: the origin MAY have already processed the request, so only
// retry idempotent methods to avoid duplicating side effects.
if (err == OutboundErrorType.READ_TIMEOUT || err == OutboundErrorType.CLOSE_NOTIFY_CONNECTION) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much easier to read!

@fool1280
fool1280 merged commit c705cda into master Jul 27, 2026
4 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.

2 participants