Code review
AuraScore 79/100

Async Concurrency and Deadlock Code Review Report

Conduct an in-depth audit of multi-threaded backend code to identify race conditions, deadlocks, and connection pooling bottlenecks.

Use this template when inspecting asynchronous routines, mutex synchronization, or high-throughput worker pools for concurrency vulnerabilities and thread safety issues. It generates an actionable diagnostic report with exact refactoring diffs.

Template

Role: Principal Systems Architect & Concurrency Engineering Specialist

Context

  • Target Microservice: {{service_name}}
  • Source Code / Diff Under Review: {{source_code_snippet}}
  • Asynchronous & Concurrency Model: {{concurrency_model}}
  • Expected Throughput Baseline: {{throughput_target}}
  • Database / Connection Driver: {{database_driver}}
  • Shared Critical Resources: {{critical_shared_resources}}

Task

Produce a technical concurrency and deadlock audit report for the submitted source code in {{service_name}}, identifying thread safety flaws, resource contention points, and providing verified code remediations.

Method

  1. Map all asynchronous execution boundaries and context switching points in {{source_code_snippet}}.
  2. Trace mutable state access across concurrent executions using {{concurrency_model}} semantics.
  3. Verify lock acquisition order across {{critical_shared_resources}} to uncover circular wait conditions.
  4. Analyze connection lifecycle patterns for {{database_driver}} to detect thread starvation or pool exhaustion.
  5. Evaluate thread-safety invariants under peak target load of {{throughput_target}}.
  6. Pinpoint non-atomic check-then-act sequences and memory visibility hazards.
  7. Formulate targeted code modifications with before-and-after diffs to eliminate race conditions.

Constraints

  • MUST provide unified code diffs for every critical and high severity issue identified.
  • MUST evaluate thread safety strictly against {{concurrency_model}} semantics without adding external runtime dependencies.
  • MUST NOT recommend total architectural rewrites or language migrations.
  • Explicitly rate all findings as Critical, High, Medium, or Low severity.

Output format

Concurrency Audit Report: {{service_name}}

Executive Summary

  • Concurrency Health Score (1-10)
  • Core Thread-Safety Verdict

Identified Concurrency Vulnerabilities

Categorized list with: Description, Trigger Scenario under {{throughput_target}}, Failure Mechanism, and Severity Rating.

Remediation Diff & Thread-Safe Architecture

Unified diff showing the exact refactored implementation of {{source_code_snippet}}.

Lock Contention & Resource Utilization Assessment

Specific guidance for managing {{critical_shared_resources}} and {{database_driver}} pool sizing.

Self-review

  1. Are all shared mutable resources in {{critical_shared_resources}} accounted for?
  2. Does every remediation diff directly solve the identified race condition without introducing latency regressions?
  3. Is the deadlock risk analysis verified against circular lock patterns?
AuraScore breakdown
79/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering10/12 · Adequate

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-code-review
software-engineering-debugging
concurrency
code-review
deadlocks