← Back to Pull requests

Validate shared-memory index links and check segment creation (backport #6598) #6600

Closed
unknown closed this pull request without merging on Oct 30, 2026 06:56 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 06:57 UTC
Author

Description

Even after #6503 there are issues with reading inconsistent shared memory segments.

This doesn't fix whatever is creating the bad segments (probably Windows sigint/sigterm handling dropping processes too quickly to end in a good state), but it makes it so that they aren't segfaults anymore.

Two causes, both in the vendored boost::interprocess:

1. check_sanity() only validated the allocator, and its free-block walk followed offset pointers without checking they stay inside the segment. open_port_internal then calls find<PortNode>(), which walks the named index (iset_index) through more unvalidated offset pointers. Symbolized stack, 3.6.x @ 2bad9bcca:

   iset_index::intrusive_key_value_less::operator()   <- access violation
   bstree_algorithms::lower_bound_loop
   iset_index::find / segment_manager::priv_generic_find
   SharedMemGlobal::open_port_internal                (SharedMemGlobal.hpp:1105)
   

Fix: tree_sanity.hpp adds a bounds-checked walk.

2. managed_open_or_create_impl ignored the bool returned by construct_func. create_impl returns false when constructing the segment manager throws (the exception is swallowed). The segment was still marked initialized and returned with a null segment_manager, which faulted in rbtree_best_fit::allocate on first use (this == nullptr, seen at SharedMemGlobal.hpp:1226 and SharedMemManager.hpp:401). Both the create and open branches now throw.

@Mergifyio backport 3.2.x 2.14.x 2.6.x

Contributor Checklist

  • Commit messages follow the project guidelines.

  • The code follows the style guidelines of this project.

  • Regression tests checking the bug and its fix have been added; the added tests pass locally.

  • Any new/modified methods have been properly documented using Doxygen.

  • _N/A_ Any new configuration API has an equivalent XML API.

  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.

  • Changes are API compatible.

  • _N/A_ New feature has been added to the versions.md file.

  • _N/A_ New feature has been documented.

  • Applicable backports have been included in the description.
  • Reviewer Checklist

  • The PR has a milestone assigned.

  • The title and description correctly express the PR's purpose.

  • Check contributor checklist is correct.

  • If this is a critical bug fix, backports to the critical-only supported branches have been requested.

  • Check CI results: changes do not issue any warning.

  • Check CI results: failing tests are unrelated with the changes.

  • <hr>This is an automatic backport of pull request #6598 done by Mergify.

    Diff: 338 lines (+253 / -85) across 4 files Reviewer: MiguelCompany Review duration: 1438m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 338 lines diff across 4 files
    0.42
    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.349
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6600"
    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.2% (MEDIUM) · Higher = larger blast radius
    42.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: 16.7% · Safe to merge
    16.7%