SpinTheMic
Pro

Interview practice question

Race condition in a wallet service

Backend Engineering · Concurrency · Experienced

A wallet service checks the balance in code and then debits it. Under concurrent requests, users can spend more than their balance. How do you fix it across multiple instances?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Check-then-act race across instances.
  • Atomic conditional UPDATE in DB.
  • Or SELECT FOR UPDATE.
  • Ledger with constraint.
  • Idempotency keys for retries.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics