Debug lockorder detection system
Skill kjuhwa/skills-hub/skills/debug/debug-lockorder-detection-system
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill debug-lockorder-detection-systemAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Runtime lock-order deadlock detection via a DEBUG_LOCKORDER compile flag that tracks lock acquisition order and reports circular dependencies.
SKILL.md
1.8 KB, 312 tokens by cl100k_base, as published. Nobody here has run it
Runtime Lock-Order Detection via DEBUG_LOCKORDER
When to use
Multi-threaded C++ codebases with enough locks that a human reviewer cannot prove a consistent global lock order by inspection.
Procedure
- Wrap all lock acquire/release sites in project-defined macros (e.g.
LOCK(cs)/LOCK2(a, b)) so the instrumentation lives in one place. - Gate the instrumentation behind a
DEBUG_LOCKORDERcompile flag, enabled in Debug and sanitizer CI builds, off in Release. - On each acquire, capture
{this_thread, lock_addr, call_site}into a per-thread held-lock stack and into a global(prev, next)edge set. - Whenever a new edge inverts an existing edge, fail loudly (abort in Debug, log in relaxed modes) with both call sites so the user sees the offending pair.
- Pair with a
DEBUG_LOCKCONTENTIONflag that times lock waits to surface hot contention without changing release perf.
Notes
- Store the held-lock stack in a
thread_localcontainer so no shared state is on the hot path. - Call-site capture via
__FILE__/__LINE__macros is enough; no stack walking required. - Run the instrumented build under the full functional test suite once per release — most real deadlocks surface in minutes.
Evidence
doc/developer-notes.md(sections "DEBUG_LOCKORDER" and "DEBUG_LOCKCONTENTION")src/sync.h
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.