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 starts12:09first product sells out12:13HikariPool-1: active 10/10, idle 0, waiting 14012:14Connection is not available, request timed out after 30000ms
| Time | Active | Idle | Waiting |
|---|---|---|---|
| 12:05 | 3 | 7 | 0 |
| 12:09 | 4 | 6 | 0 |
| 12:11 | 7 | 3 | 0 |
| 12:13 | 10 | 0 | 140 |
Step 1 · find it
Tap the line that causes it
Mark up to 3 lines, then check. It takes 2 lines.
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.