Database Deadlocks & Storage Exhaustion
Chaos & SRE Sprint β Day 4
Inject IOChaos disk exhaustion and database deadlocks into ledger-db, and verify the full Circuit Breaker state machine (CLOSED β OPEN β HALF_OPEN β CLOSED).
In this lab playbook, you will inject a storage deadlock / disk exhaustion fault (errno: 28 ENOSPC) into ledger-db and verify that the upstream Circuit Breaker trips from CLOSED toOPEN after 3 consecutive failures, returns fast degraded queued responses (DEGRADED_QUEUED), probes HALF_OPEN after cooldown, and recovers to CLOSED.
The official reference codebase for Day 4 is hosted in the repository. Clone the repository and navigate to day-4-database-deadlocks to run the working solution.
git clone https://github.com/letstrnsfrm-ai/chaos-engineering-roadmap.git
cd chaos-engineering-roadmap/day-4-database-deadlocksInspect IOChaos Disk Exhaustion Manifest
Review the Chaos Mesh IOChaos manifest injecting errno: 28 (No space left on device) into PostgreSQL data volumes.
apiVersion: chaos-mesh.org/v1alpha1
kind: IOChaos
metadata:
name: ledger-db-disk-deadlock
namespace: checkout-mesh
spec:
action: fault
mode: one
selector:
namespaces:
- checkout-mesh
labelSelectors:
app: ledger-db
volumePath: /var/lib/postgresql/data
path: "/var/lib/postgresql/data/**/*"
errno: 28 # ENOSPC / Disk I/O exhaustion
percent: 100
duration: "60s"Verify Circuit Breaker Trip, Fast Fallback & Recovery
Execute the circuit-breaker drill to verify all four state transitions (CLOSED β OPEN β HALF_OPEN β CLOSED).
npm run test:day4- Simulated database deadlock and disk I/O exhaustion (errno 28 ENOSPC).
- Verified Circuit Breaker tripped from CLOSED to OPEN after 3 consecutive failures.
- Confirmed fast fallback (200 DEGRADED_QUEUED) prevented upstream thread pool exhaustion.
- Verified automatic HALF_OPEN probe and recovery to CLOSED once the DB lock cleared.
π§ Knowledge Check
What is the role of the HALF_OPEN state in a Circuit Breaker pattern?