internal/rest/resources/control: Use independent context for join faiure cleanup#779
Draft
claudiubelu wants to merge 1 commit into
Draft
internal/rest/resources/control: Use independent context for join faiure cleanup#779claudiubelu wants to merge 1 commit into
claudiubelu wants to merge 1 commit into
Conversation
…lure cleanup The controlPost reverter used r.Context() for all cleanup operations (PreRemove hook, certificate fetch, client creation). When a join fails due to context deadline exceeded, r.Context() may already be expired, causing the entire cleanup to silently fail and leaving a ghost node in the dqlite cluster. Use an independent context with a 2-minute timeout for cleanup operations so they can complete regardless of the original request context state. Also add error logging to GetRemoteCertificate and client creation failures which previously returned silently. Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com> (cherry picked from commit 08e72c7b1ec6c6db66c4316691de983804855ce3)
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
controlPostreverter usedr.Context()for all cleanup operations (PreRemovehook, certificate fetch, client creation).When a join fails due to context deadline exceeded,
r.Context()may already be expired, causing the entire cleanup to silently fail and leaving a ghost node in the dqlite cluster. In particular,shared.GetRemoteCertificatewas silently returning due an error returned (due tor.Context()being expired), which means thatinternalClient.DeleteClusterMemberwas never called.Use an independent context with a 2-minute timeout for cleanup operations so they can complete regardless of the original request context state.
Also add error logging to
GetRemoteCertificateand client creation failures which previously returned silently.(cherry picked from commit 08e72c7b1ec6c6db66c4316691de983804855ce3)