8000 [BUG] A delayed start transition resurrects a terminated cluster · Issue #46 · dmux/minilake · GitHub
[go: up one dir, main page]

Skip to content
10BC8

[BUG] A delayed start transition resurrects a terminated cluster #46

Closed

Description

@eddiethedean

Description

Terminating a cluster while its start timer is pending first reaches TERMINATED, then silently returns to RUNNING when the old start task fires.

Reproduced on MiniLake 1.9.0, commit fe8837dcfac9df621dfabc440abc07ebb4cdbcbb, using the repository's Docker test image, a real HTTP server, and fresh disposable state. Image Python sources were verified byte-for-byte against this commit. No mocks or production data were used.

Affected Components

Steps to Reproduce

Use a disposable instance and data directory. Paths below are relative to its HTTP base URL; bodies are JSON unless explicitly described as raw bytes. IDs shown as W/J/R/Q/C/HANDLE are replaced with the IDs returned by prior calls.

  1. Start with MINILAKE_CLUSTER_START_DELAY=0.6 and MINILAKE_CLUSTER_TERMINATE_DELAY=0.1.
  2. POST /api/2.1/clusters/create with {"cluster_name":"race","spark_version":"13.3.x-scala2.12","node_type_id":"Standard_DS3_v2","num_workers":1}; capture C.
  3. Immediately POST /api/2.1/clusters/delete with {"cluster_id":"C"}.
  4. GET /api/2.1/clusters/get?cluster_id=C after 0.2 seconds and again after an additional 0.6 seconds.

Expected Behavior

The latest termination request wins; the cluster stays TERMINATED until a later explicit start.

Actual Behavior

First GET reports TERMINATED; the later GET reports RUNNING without any new start request.

Root Cause Analysis

Each lifecycle operation schedules an independent task. _transition checks only that the cluster exists, then writes its target state without checking the operation generation or expected prior state.

Impact

SDK waiters and Terraform observe lifecycle reversals and incorrect state. There is no actual compute here, but the implemented lifecycle emulation becomes unreliable.

Severity is assessed within MiniLake's documented local development/CI use; it does not assume a shared production Databricks deployment.

Suggested Fix

Track/cancel outstanding transitions per cluster or use generation tokens with expected-state checks so stale operations cannot overwrite later requests.

Test Coverage Gaps

Lifecycle tests wait for each operation to finish before starting the next. Add create-then-immediate-terminate and overlapping start/restart/resize/terminate requests.

Severity

Medium

Confidence

High — reproduced through the real HTTP API and traced to the source paths above.

Recommended Labels

bug

Existing Issue Matches

No reasonable duplicate found. Reviewed all open and closed issues and open pull requests in dmux/minilake, then searched component/function/symptom terms for this finding. The only open PR at review time, #29, changes the virtualenv lock entry and does not address this defect. The documented intentional limitations were checked before reporting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0