Missing timeout: Product pages stop loading when the stock service gets slow
Missing timeout debugging lab. The stock service got slow, not down. Now the product service doesn't answer at all. Fix it live, then prove it under load.
Practice debugging a missing timeout in a live, broken production system in your browser, with HTTP. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
1. The Incident Context
At 10:41 the inventory team started a reindex. Their API got slow, but it stayed up. Within a minute the product service stopped answering almost every request, on every product page. Restarting the product service helps for a few seconds, then it locks up again.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
GET /products/{id} on the product service. It calls GET http://localhost:9090/stock/{id} on the inventory service.
- Behavior: At 50 req/s, requests take about 10 ms. Once inventory starts taking 30 s to answer some calls, product requests pile up and never come back. In-flight requests go from a handful to several thousand.
- Error Rate: Clients give up at their own 5 s timeout. Almost 100% of requests fail once the pile-up starts.
- System Metrics: Product service CPU is low. Open connections from the product service to inventory keep growing, and inventory's queue keeps growing with them. Memory keeps climbing.
3. Application Logs
2026/10/12 10:41:00 product service listening on :8080
2026/10/12 10:41:22 in_flight=2140
2026/10/12 10:41:32 in_flight=4610
# curl
$ time curl -s localhost:8080/products/3
^C
real 0m41.002s
# inventory stats
{"busy_workers":32,"queued":2071,"open_conns":2096,...}
# k6
http_req_failed................: 98.90%
http_req_duration..............: avg=4.99s p(99)=5.00s
4. Your Objective
Step into the live environment while synthetic traffic is running, find the root cause, and patch the code.
To clear this stack, your fix must pass these checks under a 60-second load test at 50 req/s, with inventory taking 30 s on 40% of calls:
- Error Rate: Fewer than 1% of requests fail (
http_errors < 1%).
- Performance: P99 latency stays below 400 ms (
p99_latency_ms < 400).
- Data Integrity: When inventory answers, the response includes its stock count. When it doesn't, the response returns
"stock": null and "stockKnown": false instead of failing. Most pages must still carry a real stock count (data_integrity).
Toolbox: curl localhost:8080/products/3, curl localhost:9090/stock/3, curl localhost:9090/stats, curl -X POST localhost:9090/chaos -d '{"latencyMs": 30000, "ratio": 0.4}' ({"latencyMs": 0} turns it off). Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Terms in this lab: req/s (requests per second), p99 (99% of requests finished faster than this), in-flight (started but not yet answered), CPU, k6 (the load-testing tool).
Your account and data
You can browse stacks without an account. To run labs you sign in with your email or Google account. BustedStack uses your email address to
sign you in, and your name and profile picture to show your account and pre-fill certificates. We never access your Gmail, contacts or Drive,
sell your data or run ad trackers.
Privacy Policy · Terms of Service · Browse stacks ·
hello@bustedstack.com
This site needs JavaScript to run labs.