Failures and antipatterns · Intermediate

Livelock: activity without useful progress

Recognize mutually interfering retries and measure completed work rather than mere activity.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. Activity is not completion
  2. Synchronized retries
  3. Break the interference pattern
  4. Verify completed work
  5. Ask Logeia about this articleCheck your understanding

Activity is not completion

In livelock, participants keep changing state or retrying, yet their responses interfere and useful work does not finish. This differs from participants being blocked in a deadlock. A busy log or an active CPU is not proof that the intended operation is making progress.

Measure completions and time to success alongside attempts. A system can look highly active while spending most of its capacity on recovery behavior. The distinction helps avoid treating a larger retry counter as a sign that the system is successfully working through a backlog.

Synchronized retries

Imagine two operations that release their resources when they detect conflict, wait for the same interval and try again. If they remain synchronized, they can collide again and repeat the response. A policy intended to resolve contention then recreates the conditions for the next collision.

This is a possible execution pattern, not a claim that every run must behave identically. Timing and scheduling matter. A small sequential test may never expose the issue that emerges when many participants execute the retry policy at nearly the same time.

Break the interference pattern

Randomized delay or exponential backoff can reduce synchronized collisions by spreading attempts over time. Bound the maximum delay, total deadline and number of attempts as well. Increasing waits indefinitely would simply replace one failure mode with unacceptable completion latency.

In some cases, explicit ordering or a coordinator produces a simpler progress argument. Distinguish changing the conflict rule from merely improving the probability of success. Randomization can be useful without establishing a deterministic guarantee that every participant finishes by a specified time.

Verify completed work

After a change, verify that the required work completes within acceptable latency, not merely that the retry count falls. Record conflicts, concurrency and deadline failures so that lower offered workload is not mistaken for a successful progress fix.

Retried state-changing operations also need duplicate-effect protection. Breaking the interference pattern may allow several previously repeated requests to succeed. A system that now completes work but applies the same operation multiple times is not correct. Progress and application invariants need separate acceptance checks.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Build your CS foundations · STEP 18

Understand the systems behind the web · STEP 15

Choose a learning path