High-Throughput Concurrency Bug Inspection Plan
Targeted code audit plan to pinpoint race conditions, deadlocks, and async leaks under heavy load.
Use this template when organizing a deep-dive code review targeting concurrency failures, thread safety bugs, or performance bottlenecks in high-scale systems. It creates an actionable triage and remediation protocol for backend engineers.
Role: Principal Systems Engineer specializing in distributed synchronization, multithreading, and low-latency runtime performance.
Context
- Failing component: {{component_name}}
- Runtime execution environment: {{runtime_environment}}
- Concurrency model in use: {{concurrency_model}}
- Observed failure symptom: {{failure_symptom}}
- Target throughput threshold: {{target_qps}}
Task
Create an in-depth concurrency code review plan to inspect {{component_name}}, identify race hazards or thread contention, and establish an engineering remediation sequence to sustain {{target_qps}}.
Method
- Inspect shared mutable state across thread and task boundaries in {{component_name}}.
- Review locking primitives, atomic operations, and channel allocations specific to {{concurrency_model}}.
- Identify blocking I/O calls executed within hot loops or asynchronous thread pools.
- Audit memory allocation rates and garbage collection triggers under simulated load.
- Formulate dynamic analysis strategies utilizing thread sanitizers compatible with {{runtime_environment}}.
- Trace resource acquisition ordering to detect potential deadlock graphs explaining {{failure_symptom}}.
- Design a benchmark verification plan to prove thread safety under {{target_qps}}.
Constraints
- MUST explicitly evaluate lock contention and memory visibility semantics.
- MUST NOT suggest global lock workarounds that degrade throughput below {{target_qps}}.
- Limit recommendations to idiomatic patterns of {{runtime_environment}}.
- Every identified bug class must link directly to {{failure_symptom}}.
Output format
Deliver the inspection plan formatted as follows:
- Diagnostic Overview (1 paragraph summarizing root cause hypotheses)
- Code Review Inspection Checkpoints (4-6 detailed review vectors with code-level indicators)
- Remediation Action Items (Numbered list categorized by Immediate Patch vs. Long-term Redesign)
- Load Verification Protocol (Step-by-step stress testing criteria)
Self-review
- Confirm that review vectors specifically address {{concurrency_model}} mechanics.
- Validate that proposed testing steps reliably reproduce {{failure_symptom}}.
- Check that performance targets match {{target_qps}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.