objcache: avoid unsafe database sharing under QEMU user emulation #63114
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 · 327 lines diff across 4 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.347
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #63114"
general
weight: 0.35
xal-0
Julia's compiled-code cache can become unusable after a process running under QEMU user-mode emulation dies while holding a database lock. Later processes using the same cache can then hang, including native Julia processes sharing the depot.
On Linux, LMDB uses process-shared robust mutexes. Normally, the kernel marks a lock when its owner dies so the next process can recover it. QEMU user mode does not implement the robust-list syscalls needed for this recovery, but glibc can still allow the mutex to be created. QEMU's syscall implementation explicitly returns
ENOSYSfor both operations.For example, a small C reproducer on Linux with glibc 2.44 and QEMU 11.1.1 creates a shared robust mutex, lets a child exit while holding it, and tries to acquire it with a two-second deadline:
LMDB's ordinary lock acquisition has no such deadline. This PR checks
get_robust_listbefore opening the database and disables caching if the query fails. Julia continues compiling normally, and the REPL explains:The query reads the current thread's registration without replacing libc's robust list. This is a conservative check for the QEMU limitation: a sandbox denying the query also disables caching, and success does not prove that every robust-mutex operation works in an arbitrary environment. Non-Linux platforms retain their existing behavior.
The PR also separates default databases by the JIT's target triple:
This addresses a separate compatibility problem: builds sharing a depot can have different word sizes or libc mutex layouts. Different keys for compiled code do not make the underlying LMDB files compatible. Target-specific directories keep those databases apart. The syscall check is still needed when native and emulated processes have the same target triple.
Existing cache files are left in place; the new directories start empty. An explicit
JULIA_OBJCACHE_PATHis still used verbatim, so callers setting it must choose separate paths for incompatible targets.