One shared context, and every user reading each other’s messages
Concurrency bug / Donna, SaaS for teams
A single context object was initialised once and shared across the whole process. Under concurrent load an async race condition overwrote it, so one user’s conversation, including sensitive content, surfaced inside another user’s session. The product worked perfectly with one user and leaked with two.
What I did
- Reproduced the race rather than guessing at it, and traced it to singleton initialisation running concurrently.
- Rebuilt initialisation with double-checked locking under an asyncio.Lock, so the object is constructed exactly once and never mid-flight for a second caller.
- Isolated context per user and per session, so the failure mode cannot recur by a different route.
Employer product. The public product page is linked; internal dashboards, admin panels, and architecture diagrams are not shown.
- Python
- asyncio
- FastAPI
