Poison message debugging lab. The refund worker is busy at full CPU and logging nonstop, yet no customer has been refunded for an hour.
Practice debugging a poison message in a live, broken production system in your browser, with 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.
1. The Incident Context
No customer has received a refund since 07:12. The refund worker is up, passes its health check and logs nonstop. Support noticed that the last successful refund came just before a request from a legacy partner, whose payloads write amounts in a different format.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
POST /refunds (queues each request as received), the refund worker inside the refunds service, RabbitMQ queue refunds.requested, Postgres refunds table, the payment gateway at localhost:9200.
- Behavior: The worker receives the same few messages thousands of times per second. New refund requests keep arriving and wait behind them, so the queue grows steadily. Valid refunds are almost never paid.
- Error Rate:
POST /refunds returns 202 Accepted as normal. The refund completion rate has dropped to near zero.
- System Metrics: Worker CPU is pinned. RabbitMQ shows a very high redelivery rate on
refunds.requested and almost no acks. Broker CPU is rising too. A refunds.dead queue exists, but it is empty.
3. Application Logs
2026/10/12 07:12:40 refunds worker started, concurrency=4, prefetch=4
2026/10/12 07:12:41 refund msg 5f1c3a90: decode amount: "12,50" is not a decimal number; nacking with requeue
2026/10/12 07:12:41 refund msg 5f1c3a90: decode amount: "12,50" is not a decimal number; nacking with requeue
2026/10/12 07:12:41 refund msg 5f1c3a90: decode amount: "12,50" is not a decimal number; nacking with requeue
# curl -su guest:guest localhost:15672/api/queues/%2F/refunds.requested
{"name":"refunds.requested","messages":8412,"messages_unacknowledged":4,
"message_stats":{"ack_details":{"rate":0.0},"redeliver_details":{"rate":6120.4}}, ...}
# psql: SELECT count(*), max(completed_at) FROM refunds;
count | max
-------+-------------------------------
1913 | 2026-10-12 07:12:40.881+00
4. Your Objective
Step into the live environment while synthetic traffic is running, diagnose the root cause, and patch the codebase.
To clear this stack, your fix must satisfy these automated verification checks under a 60-second test at 30 refunds/s, where 2% of the requests are malformed in ways that can never succeed and the gateway answers 503 on 10% of calls:
- Throughput: At least 99% of valid refunds are paid and marked completed within 20 seconds of the test ending (
refunds_not_completed_rate <= 0.01).
- Isolation: Every malformed message ends up in the
refunds.dead queue with its original body and a header saying why it failed (poison_not_dead_lettered == 0), and no valid refund ends up there (valid_dead_lettered == 0).
- Data Integrity: No refund is paid twice, by the gateway's own books (
double_paid_refunds == 0).
- Error Rate: Fewer than 1% of
POST /refunds requests fail (http_errors < 1%).
Environment note: the refunds.dead queue already exists, but nothing is bound to it. The gateway accepts an optional Idempotency-Key header: a repeated key gets back the original answer instead of paying again.
Toolbox: curl -su guest:guest localhost:15672/api/queues (RabbitMQ management API), curl -su guest:guest -X POST localhost:15672/api/queues/%2F/refunds.dead/get -d '{"count": 5, "ackmode": "ack_requeue_true", "encoding": "auto"}', curl localhost:9200/stats, psql "$DATABASE_URL" -c "SELECT count(*), max(completed_at) FROM refunds", and curl -X POST localhost:8080/refunds -H 'Content-Type: application/json' -d '{"refundId": "rf-test-1", "orderId": 7, "amount": "12.50", "currency": "EUR"}'. 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 (the message queue server, RabbitMQ), consumer / worker, ack / nack (tell the broker a message is done / failed), requeue (put a failed message back on the queue), unacked, prefetch (how many unacked messages one consumer may hold), redelivery, dead-letter queue (a side queue that parks messages that can't be processed), idempotency key, 202, 503.
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.