← Back to Pull requests

[bug] Build cache_memory buffer on the streaming engine to avoid in-memory deadlock #81

Closed
unknown closed this pull request without merging on Oct 17, 2026 19:05 UTC
View on GitHub
unknown unknown commented on Oct 15, 2026 21:16 UTC
Author

Description

cache_memory builds its buffer with a nested collect() inside the register_io_source generator. On the in-memory engine that build can deadlock when the cache is read from several branches and another branch runs its own nested collect() (for example pushdown_combine): a Rayon worker waiting on the build work-steals the other collect's job, whose leaf is a PythonScanExec on the same cache, and the build never resumes. The query then hangs under POLARS_ENGINE_AFFINITY=in-memory.

Collecting the build on the streaming engine avoids this. Gated at Polars >= 1.26, where the streaming engine runs io_source sources; below that it falls back to the in-memory collect() and the deadlock remains.

No regression test is included: reliably reproducing the deadlock needs a slow, probabilistic multi-thread subprocess loop whose cost and flakiness outweigh its value as a sentinel. Existing tests in test_lazy_cache_memory.py cover build-once and correctness.

Type of Change

  • Bug fix
  • Checklist

  • Linting passes (ruff)

  • Tests pass (existing io_source suites)

  • New tests added for new functionality

  • Documentation updated (if applicable)

  • Changelog / version bump (if applicable)
  • Diff: 156 lines (+117 / -39) across 1 files Reviewer: timkpaine Review duration: 2749m
    All Vouch review confidence checks passed
    Residual risk 0.13 = Change Risk (0.33) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.33 · 156 lines diff across 1 files
    0.33
    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.303
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #81"
    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: 33.2% (LOW) · Higher = larger blast radius
    33.2%
    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: 13.1% · Safe to merge
    13.1%