← Back to Pull requests

Reset retry task state between test suites [reduced-it] #16983

Closed
unknown closed this pull request without merging on Nov 17, 2026 11:39 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 09:41 UTC
Author

Fixes #16982.

Description

TaskRegistryTracker and ScalableTaskCompletion keep retry task registrations and task-completion callbacks for the whole JVM, keyed by task attempt id. A suite that registers a mock task that never completes leaves them behind. In a parallel test worker, the real tasks of later SparkContexts reuse those task ids and join the stale entries: their completion callbacks never run, their threads stay registered as dedicated task threads, and later tasks on those threads are no longer associated with a task in RMM. Retry OOM injection then fails with the thread is not associated with any task/shuffle, as in ParquetScanSuite after GpuNullBatchIteratorSuite (see the issue).

This change:

  • resets ScalableTaskCompletion and TaskRegistryTracker in ParallelUnitTestRunner.cleanupWorkerState, so every suite in a worker starts without the retry task state of the suites before it, in the same order as #16964 does for WithRetrySuite;

  • runs the mock tasks of the GpuNullBatchIteratorSuite semaphore test, which left the state behind, in TestUtils.withTaskContext, which resets their callbacks when the test ends, so that serial runs in one JVM are also clean.
  • Tests:

  • ParallelUnitTestRunnerSuite: a mock task 1 registers a dedicated thread and a completion callback and never completes. After cleanupWorkerState, the callback has run, and a new task 1 on the same thread registers its thread and unregisters it when it completes. The test fails without the reset in cleanupWorkerState.
  • Validation:

  • Reproduced the failure on main c3175518cd with Spark 3.5.2 (-Dbuildver=352) by running, in one JVM, the 34 suites that preceded ParquetScanSuite in the failing CI worker and then ParquetScanSuite: its three OOM-injection tests failed with the CI error. With this change, the same sequence passed (504 tests).

  • Ran ParallelUnitTestRunnerSuite and GpuNullBatchIteratorSuite with -Dbuildver=352 and with -Dbuildver=420 (Scala 2.13): 32 passed on each. Without the reset in cleanupWorkerState, the new test fails.

  • Ran scalastyle on all modules: 0 errors.

  • Not run locally: the parallel runner end to end. It requires at least two forks and assigns suites to workers dynamically, so it cannot reproduce a given suite order.
  • This change and the PR description were prepared with AI assistance and reviewed by the author before submission.

    Checklists

    Documentation

  • Updated for new or modified user-facing features or behaviors

  • No user-facing change
  • Testing

  • Added or modified tests to cover new code paths

  • Covered by existing tests

  • (Please provide the names of the existing tests in the PR description.)
  • Not required
  • Performance

  • Tests ran and results are added in the PR description

  • Issue filed with a link in the PR description

  • Not required

  • This changes test code only, which is not packaged in runtime artifacts.

    Diff: 370 lines (+277 / -93) across 4 files Reviewer: res-life Review duration: 117m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 370 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #16983"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 16.9% · Safe to merge
    16.9%