← Back to Pull requests

objcache: stop leaking SysV semaphores on macOS, and disable quietly when they run out #64447

Closed
unknown closed this pull request without merging on Nov 03, 2026 15:01 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 09:10 UTC
Author

We're seeing a lot of macOS failures because of this currently, so trying to fix it.

https://github.com/JuliaCI/sandboxed-buildkite-agent/pull/179 has been deployed.

After this merges the machines should be rebooted/semaphores cleared.

Claude:

---

On macOS, LMDB locks the objcache with a SysV semaphore set. Only mdb_env_close removes that set, and Julia never closes the environment. So every process that opens a new cache directory leaves one set behind until reboot (#63789). When the system limit is reached, opening the cache fails with ENOSPC and Julia prints objcache error (228): No space left on device. That is breaking master CI on the macOS aarch64 machines, e.g. https://buildkite.com/julialang/julia-ci/builds/1229#01a1852f-5b7a-48c7-b7fe-b9ee76dcd3dc.

  • Commit 1 treats ENOSPC like the other expected open failures: the cache is disabled quietly and the REPL banner says why. This is enough to stop the CI failures.

  • Commit 2 patches LMDB with mdb_env_release_locks, which does only the semaphore part of mdb_env_close and keeps the memory map that JIT buffers point into. Julia calls it at shutdown. Starting a transaction now takes a shared lock that shutdown takes exclusively, so none can start after the semaphores are gone. An open that races with the last user's exit retries once.

  • Commit 3 fixes a gap in commit 2 that Codex found in review: processes that share a cache and exit at the same time each saw the others' shared locks, so none removed the set (mdb_env_close has the same race). Each process now drops its shared lock before trying the exclusive one, so the last of them removes it.
  • LMDB is always built from source here, so no Yggdrasil change is needed. USE_SYSTEM_LMDB builds compile without the patch and keep the old behaviour.

    Testing so far: the LMDB patch on its own, built in its SysV mode on Linux. Exiting without the new call leaks one set per process, and with it none; a set still in use by another process is kept. On macOS, with a C test where 4 processes release together and stay alive afterwards, commit 2's patch leaked the set every time and commit 3's removes it. The Julia build and the new test/jit.jl test have not been run locally yet.

    Fixes #63789

    Written with Claude Code (Claude Opus 5.5), with review by Codex.

    Diff: 290 lines (+217 / -73) across 3 files Reviewer: IanButterworth Review duration: 7550m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 290 lines diff across 3 files
    0.45
    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.339
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #64447"
    general weight: 0.35
    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: 44.9% (MEDIUM) · Higher = larger blast radius
    44.9%
    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: 17.7% · Safe to merge
    17.7%