Skip to content

internal/rest/resources/control: Use independent context for join faiure cleanup#778

Draft
claudiubelu wants to merge 1 commit into
canonical:v3from
claudiubelu:v3-new-cleanup-context
Draft

internal/rest/resources/control: Use independent context for join faiure cleanup#778
claudiubelu wants to merge 1 commit into
canonical:v3from
claudiubelu:v3-new-cleanup-context

Conversation

@claudiubelu

Copy link
Copy Markdown
Contributor

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. In particular, shared.GetRemoteCertificate was silently returning due an error returned (due to r.Context() being expired), which means that internalClient.DeleteClusterMember was 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 GetRemoteCertificate and client creation failures which previously returned silently.

(cherry picked from commit 08e72c7b1ec6c6db66c4316691de983804855ce3)

…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. In particular, shared.GetRemoteCertificate was
silently returning due an error returned (due to r.Context() being expired),
which means that internalClient.DeleteClusterMember was 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 GetRemoteCertificate and client creation
failures which previously returned silently.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
(cherry picked from commit 08e72c7b1ec6c6db66c4316691de983804855ce3)
@roosterfish roosterfish marked this pull request as draft July 8, 2026 12:41
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