Skip to content

Slot migration fails silently when SetSlotRange times out or faults #1655

@kevinmichaelbowersox

Description

@kevinmichaelbowersox

Slot migration fails silently when SetSlotRange times out or faults

Describe the bug

During cluster slot migration, MigrateSession.TrySetSlotRanges can silently fail without marking the migration as failed, leaving slots in an indeterminate state.

The method uses a .ContinueWith(TaskContinuationOptions.OnlyOnRanToCompletion).WaitAsync().Result pattern to send CLUSTER SETSLOTRANGE commands to the target node. When the underlying task times out, is canceled, or faults, the OnlyOnRanToCompletion continuation never executes. The resulting exception is caught by the generic catch (Exception) block, which returns false but does not set Status = MigrateState.FAIL. This leaves the migration session in a PENDING state rather than FAIL, which can prevent proper recovery and cleanup.

Additionally, the error message triggering the initial failure is lost.

Steps to reproduce the bug

Trigger a migration that fails
Inspect logs

Expected behavior

Expected behavior

When SetSlotRange fails for any reason (timeout, cancellation, network error), the migration session should:

  1. Set Status = MigrateState.FAIL
  2. Log a diagnostic message that identifies the affected slots and the nature of the failure
  3. Return false so the caller can trigger recovery

Screenshots

No response

Release version

No response

IDE

No response

OS version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions