objcache: stop leaking SysV semaphores on macOS, and disable quietly when they run out #64447
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
IanButterworth
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_closeremoves 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 withENOSPCand Julia printsobjcache 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.ENOSPClike the other expected open failures: the cache is disabled quietly and the REPL banner says why. This is enough to stop the CI failures.mdb_env_release_locks, which does only the semaphore part ofmdb_env_closeand 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.mdb_env_closehas 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_LMDBbuilds 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.jltest have not been run locally yet.Fixes #63789
Written with Claude Code (Claude Opus 5.5), with review by Codex.