Member-only story
Your Web Application May Have Bugs Due to Race Conditions
These six sequence diagrams can help you figure out why
Published in
6 min readMay 25, 2022
A Normal Web Application
We know that a normal web service model looks like this:
- The user performs an operation and sends an HTTP request on the client side.
- The server returns an HTTP response.
- The client renders the webpage based on the data.
- Repeat these processes.
If a sequence diagram represents it, it looks like this:
![](https://miro.medium.com/v2/resize:fit:700/1*eynu32Lvp7BqqOV-obzXxQ.png)
Everything is OK.
Race Conditions
But, there is always a ‘but.’
In the above model, we assume that ResponseA
is always returned to the client before ResponseB
. But the real scene is complex, and there are always various problems. It may be due to the fluctuations in the user’s network or the server blockages, and ResponseA
may be returned to the client later than ResponseB
.
This may lead to the following results: