Member-only story

Your Web Application May Have Bugs Due to Race Conditions

These six sequence diagrams can help you figure out why

Shuai Li
Better Programming
6 min readMay 25, 2022

--

Photo by Dylan Hunter on Unsplash

A Normal Web Application

We know that a normal web service model looks like this:

  1. The user performs an operation and sends an HTTP request on the client side.
  2. The server returns an HTTP response.
  3. The client renders the webpage based on the data.
  4. Repeat these processes.

If a sequence diagram represents it, it looks like this:

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:

--

--

Shuai Li
Shuai Li

Written by Shuai Li

An enthusiastic game player of Earth Online.

No responses yet

What are your thoughts?