Keep console_bridge's output handler and the loader mutex alive until the class loaders are destroyed #252
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 305 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.342
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #252"
general
weight: 0.35
mjcarroll
On macOS every process that still holds class loaders through
MultiLibraryClassLoaderat exit aborts (seen withrqt, e.g.rqt --list-pluginsexits with code 134):The exception is
std::system_error: mutex lock failed, thrown fromconsole_bridge::log(called byCONSOLE_BRIDGE_logDebugin~ClassLoader()): console_bridge's output handler, a function-local static with a mutex, has already been destroyed when the staticClassLoaderPtrVectorImpldestroys the remaining loaders.ClassLoaderDependencyalready constructs class_loader's own statics beforeclass_loader_ptrs_so that they are destroyed after it. This addsconsole_bridge::getLogLevel()there, which constructs console_bridge's output handler first, so it is destroyed after the loaders as well.Loader mutex (rolling):
getLoaderMutex(), added for concurrent load and unload, is another function-local static that~ClassLoader()uses:unloadLibrary()locks it. It wasn't constructed inClassLoaderDependency()either, so with only the console_bridge fix, the same exit path still aborted, this time withrecursive_mutex lock failed. This PR moves it out of the anonymous namespace, declares it inclass_loader_core.hppnext to the other impl mutex accessors, and constructs it inClassLoaderDependency()too.Regression test:
test/exit_order_test.cppis its own executable, so none of these statics exist before the test runs. Its death test exits while aMultiLibraryClassLoaderstill holds a library. On macOS (arm64), with rolling at 6aff570:mutex lock failed.Other testing:
test/base.hppalso predates this PR.rqt --list-pluginsexits with 0 instead of aborting.🤖 Claude (AI assistant), on behalf of @Tobias-Fischer
🤖 Generated with Claude Code