← Back to Pull requests

Fix asynchronous sink flush hangs and incomplete flushes #259

Open
unknown opened this pull request with 229 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 08, 2026 18:29 UTC
Author

asynchronous_sink::flush() can leave logging blocked or return before queued records have been processed:

  • If record processing throws while the calling thread drains the queue during flush(), the flush-requested flag remains set. Later consume() calls block indefinitely, and try_consume() rejects records.

  • With caller-driven feeding (start_thread=false), flush() can wait indefinitely if the feeding call exits or throws while a flush request is pending. Producers also remain blocked.

  • With an ordering queue, try_dequeue_ready() can return false while records remain inside the ordering window. If a flush request arrives after the feeder chooses that ready-only check, the original code can leave the dequeue loop and flush the backend without first draining those records.
  • Retry with try_dequeue() when a flush arrives during a failed ready-record check. Keep later requests pending until a feeding operation can drain them. Let waiting flush callers take over when feeding ends, preserve pending requests across feeder changes, and clear abandoned requests so exceptions during caller-driven flushing do not leave producers blocked.

    Four separate regression executables cover feeder exceptions, incomplete ordering-queue flushes, logging after a failed flush, and feeder replacement. Against the original code, controlled queue and backend pauses demonstrate a flush exceeding its deadline, an ordering queue delivering 0 of 1 records, and producers remaining blocked after a drain exception. These cases pass with the fix.

    The feeder-replacement case guards against a regression the cleanup could introduce. Each executable has a ten-second process watchdog so a deadlock fails its own test without hanging the remaining cases. All four tests and the existing #255 regression test pass on macOS with C++11.

    Diff: 229 lines (+171 / -58) across 2 files Reviewer: Lastique Review duration: 8928m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 229 lines diff across 2 files
    0.37
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.325
    Real PR Conversation Timeline
    1 comments
    "Review active on #259"
    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: 37.0% (MEDIUM) · Higher = larger blast radius
    37.0%
    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: 19.7% · Safe to merge
    19.7%
    Repository