← Back to Pull requests

fix validator race condition for mig-manager #3156

Open
unknown opened this pull request with 333 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 02, 2026 15:41 UTC
Author

Description

We have a race condition in the mig-manager. During a MIG layout change, the cuda-validation init container of the
operator validator can create the nvidia-cuda-validator pod while MIG Manager runs nvidia-mig-parted apply. The pod runs vectorAdd with NVIDIA_VISIBLE_DEVICES=all. CUDA initialization opens every MIG instance on the node. MIG Manager then cannot destroy the compute instances, and the change fails:
error destroying Compute instance for profile '(0, 0)': ERROR_IN_USE
MIG Manager then sets nvidia.com/mig.config.state=failed.
The race occurs because:
1. MIG Manager restarts the validator and sets success before validation
finishes. A client that starts the next change on success starts it
while the validator is still running.
2. MIG Manager deletes CUDA validator pods only once, a few seconds before
apply. A pod that the validator creates after this point is not
detected.
3. The validator does not check the MIG state before it runs the workload.
Nodes with many GPUs fail more often. On 8 x H200 with all-1g.18gb
(56 MIG instances), vectorAdd held the instances for about 6 seconds, and
the first all-1g.18gb to all-1g.35gb change failed.

Fix


  • Before it creates the CUDA workload pod, the validator now waits while

  • nvidia.com/mig.config.state is pending or rebooting.
  • The poll interval is the existing --sleep-interval-seconds setting

  • (SLEEP_INTERVAL_SECONDS, default 5 seconds). The first read occurs at
    once, so a node with no MIG change in progress sends 1 extra read.
  • The wait has a 30-minute limit. At the limit, the validator returns an

  • error that names the last state. The init container fails, and the kubelet
    retries it.
  • For all other states, including no label, success, and failed, the

  • validator continues as before.

    Checklist

  • No secrets, sensitive information, or unrelated changes

  • Lint checks passing (make lint)

  • Generated assets in-sync (make validate-generated-assets)

  • Go mod artifacts in-sync (make validate-modules)

  • Test cases are added for new code paths
  • Testing

    Added unit test and also tested the fix on an actual 8 x H200 Node.

    <!-- devin-review-badge-begin -->

    ---

    <a href="https://nvidia-cloud.devinenterprise.com/review/nvidia/gpu-operator/pull/3156" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
    <!-- devin-review-badge-end -->

    Diff: 333 lines (+249 / -84) across 4 files Reviewer: rahulait Review duration: 7842m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 333 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.348
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #3156"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.1% (MEDIUM) · Higher = larger blast radius
    42.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%