Skip to content
Chaos Lab

Debug the code · lab 3 · intermediate · about 7 min

Fine until it sells out

A flash sale starts at 12:00. Checkout reserves stock with plain JDBC through the shop's HikariCP pool of 10 connections. For nine minutes everything is fast. At 12:09 the first product sells out, and four minutes later every checkout is stuck waiting for a connection. The database itself is nearly idle.

  • Your fix must
  • No request waits for a connection during the sale
  • No connection leaks on any path, errors included
  • Checkout p99 under 400 ms
Checkout p9930.00 starget < 400 ms

Pager timeline

Logs and signalsReconstructed
12:00flash sale starts
12:09first product sells out
12:13HikariPool-1: active 10/10, idle 0, waiting 140
12:14Connection is not available, request timed out after 30000ms
Hikari pool · checkout
TimeActiveIdleWaiting
12:05370
12:09460
12:11730
12:13100140

Step 1 · find it

Tap the line that causes it

Mark up to 3 lines, then check. It takes 2 lines.

StockRepository.javaJava 21 · Spring Boot 3 · JDBC

No line marked yet

The code is real Spring Boot; the evidence and every patch's numbers are simulated and illustrative. Nothing runs in your browser.