fix(dgw): retry transient KDC connection drops#1863
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds bounded retries for transient direct KDC failures with exponential backoff and improved diagnostics.
Changes:
- Classifies transient and permanent KDC I/O failures.
- Retries direct exchanges with equal-jitter backoff.
- Adds supporting dependencies and helper tests.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
devolutions-gateway/src/kdc_connector.rs |
Implements retry behavior, logging, classification, and tests. |
devolutions-gateway/Cargo.toml |
Adds retry and randomness dependencies. |
Cargo.lock |
Locks the new dependency graph. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
devolutions-gateway/src/kdc_connector.rs:147
- The retry tests verify attempt counts but not the configured 1.2/2.4/4.8-second delay maxima, so an accidental change to this base or factor would leave all tests passing while changing the main operational behavior. Please assert the elapsed paused Tokio time stays within the equal-jitter bounds, or expose the strategy and test each generated delay range.
let backoff = ExponentialBackoff::from_millis(2)
.factor(600)
.max_delay(Duration::from_secs(10))
.map(equal_jitter)
.take(KDC_MAX_RETRIES);
The KDC proxy path sometimes sees a connection accepted and then dropped before a reply is returned (suspected DC-side load: connection throttling or port exhaustion), surfacing to clients as a 502 Bad Gateway. Direct KDC exchanges are now retried up to 3 times on such transient failures, spaced with equal-jitter exponential backoff (~1.5s / 3s / 6s) so a loaded KDC gets breathing room and concurrent retries do not synchronize into a storm. Permanent failures are still surfaced immediately, and the KDC target host is now shown at info level for easier diagnosis. Issue: DGW-423
Benoît Cortier (CBenoit)
force-pushed
the
fix/kdc-proxy-retrial
branch
from
July 24, 2026 13:58
4dd7cc7 to
48b7c47
Compare
Richard Markiewicz (thenextman)
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The KDC proxy path sometimes sees a connection accepted and then dropped before a reply is returned (suspected DC-side load: connection throttling or port exhaustion), surfacing to clients as a 502 Bad Gateway. Direct KDC exchanges are now retried up to 3 times on such transient failures, spaced with equal-jitter exponential backoff (max 1.2s / 2.4s / 4.8s) so a loaded KDC gets breathing room and concurrent retries do not synchronize into a storm. Permanent failures are still surfaced immediately, and the KDC target host is now shown at info level for easier diagnosis.
Issue: DGW-423