SpinTheMic
Pro

Interview practice question

User data leaking between requests

Backend Engineering · Concurrency · Intermediate

Users occasionally see another user's data in your web app. Investigation shows a class stores the current user in an instance field of a singleton. What is wrong?

What a strong answer covers

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

  • Singleton shared across concurrent requests.
  • Instance field overwritten by other requests.
  • Use request-scoped data or parameters.
  • Thread-locals with care / context propagation.
  • Avoid mutable state in singletons.
Practise this topic

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

See all topics