No backpressure debugging lab. The loyalty worker comes back to a big queue backlog, crashes within seconds, and takes checkout down with it on every restart.
Practice debugging a no backpressure in a live, broken production system in your browser, with Go and RabbitMQ and PostgreSQL. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
> Go only. This stack is about how a Go service behaves when it is handed far more work than it can finish, so it ships in Go alone.
1. The Incident Context
The loyalty-points consumer was paused for an hour during a migration, and order.completed events piled up in RabbitMQ. When it came back at 04:00, it crashed within 30 seconds, and every restart crashes the same way. While it runs, the checkout service, which shares the Postgres cluster, slows to a crawl and starts failing.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components: the
loyalty consumer (your app), RabbitMQ queue order.completed, Postgres loyalty_points and orders tables, and POST /checkout on the checkout service at localhost:9100 (it shares the database).
- Behavior: Right after the consumer starts, RabbitMQ shows almost the whole backlog as unacked. The consumer's goroutine count jumps to tens of thousands. Its Postgres connections hit the server's limit, and checkout can no longer get a connection. After the crash, every unacked event goes back to the queue and the cycle repeats.
- Error Rate: Checkout fails a large share of requests while the consumer runs. The consumer never makes real progress through the backlog.
- System Metrics: Consumer memory climbs past its 300 MB limit in seconds and the process is OOM-killed. Postgres reports
FATAL: sorry, too many clients already. Queue depth barely moves. Some customers have been awarded points twice for one order.
3. Application Logs
2026/10/12 04:00:00 loyalty consumer started, prefetch=0
2026/10/12 04:00:02 goroutines=58204
2026/10/12 04:00:03 award points for order 88213: failed to connect to `user=lab database=lab`: server error: FATAL: sorry, too many clients already (SQLSTATE 53300)
2026/10/12 04:00:03 award points for order 88214: failed to connect to `user=lab database=lab`: server error: FATAL: sorry, too many clients already (SQLSTATE 53300)
2026/10/12 04:00:21 Memory cgroup out of memory: Killed process 412 (app) anon-rss:311296kB, limit 300MB
# curl -su guest:guest localhost:15672/api/queues/%2F/order.completed
"messages":60000, "messages_ready":129, "messages_unacknowledged":59871
# k6 (checkout)
checkout_failed................: 41.27%
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 during a 90-second test that starts with a backlog of 60,000 events while checkout gets 30 req/s:
- Error Rate: Checkout fails fewer than 1% of requests (
checkout_failed < 1%) and its P99 latency stays below 300 ms (checkout_duration p99 < 300).
- Throughput: The consumer is never OOM-killed (
consumer_restarts == 0) and awards points for at least 45,000 orders during the test (drained >= 45000).
- Data Integrity: Every order gets exactly the right points exactly once, even though the consumer is killed once midway (
data_integrity).
Environment note: the grader kills the consumer once at the 45-second mark with SIGKILL. It comes back a second later. The killed run doesn't count as a restart.
Toolbox: curl -su guest:guest localhost:15672/api/queues/%2F/order.completed, psql "$DATABASE_URL" -c "SELECT application_name, state, count(*) FROM pg_stat_activity GROUP BY 1, 2", curl -X POST localhost:9100/checkout -H 'Content-Type: application/json' -d '{"customerId": 4, "total": 59.9}', curl -X POST 'localhost:9100/internal/backlog?count=60000' (refills the backlog), htop. Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Terms in this lab: broker (RabbitMQ), consumer, unacked (delivered but not yet acknowledged), ack / nack, redelivery, prefetch, goroutine, OOM-killed (killed by the kernel for using too much memory), SIGKILL, p99.
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.
This site needs JavaScript to run labs.