Catalogue / lichess-2021-tournament-queue

A single Lichess tournament's one-at-a-time event queue fell behind its players and the tournament was cancelled

Lichess, 2021. Tournament state processing.

Organisation
Lichess
Evidence
Incident report
System
Tournament state processing
As of
2021-12
Source
Our recent server issues....

Lichess blog, published 2021-12-22

Architecture

Everything that changes a tournament's state (new pairings, results of finished games, leaderboard updates, players joining) goes into a queue for that tournament and is processed one event at a time. Players add to the queue by joining and playing; Lichess drains it by computing pairings and the leaderboard.

Section: Can you elaborate on the technical issue?

Figures, as the source states them

FigureAs statedNoteWhere
Players in earlier tournaments that ran without issues30,000 playersStated as 30,000+; one tournament, not the siteNear: had tournaments with 30,000+ players in them

Records

Failure#f1

Players produced tournament events faster than the per-tournament serial queue could process them

lichess-2021-tournament-queue#f1 at corpus version 26a1b3a7e3dd
Trigger

During the Agadmator CakeDeFi tournament on 21st December 2021, for the first time players were producing tournament events faster than Lichess could process them. Lichess says it had run larger events before, but with fewer players actively playing at the same moment.

Near: Agadmator CakeDeFi tournament which occurred | Near: players were inputting events faster than Lichess | Near: fewer players actively playing at the same time

How it failed

A tournament's events are queued and handled strictly one by one to avoid race conditions. The queue kept growing, which delayed pairings, and in the end there was no way to catch up. One tournament's queue cannot be parallelised, so spare capacity elsewhere on Lichess did not help.

Section: Can you elaborate on the technical issue?

Why defences did not hold

Lichess says the weak point was completely new and unknown to it before the tournament, that earlier tournaments with 30,000+ players had run with no issues, and that simulating events at this scale is not easy. It had some concerns about the initial pairing but was cautiously optimistic that the tournament would continue without issue after it.

Section: Shouldn’t you have known what your infrastructure can support and put limits in place?

Impact

The tournament had to be cancelled. Lichess itself was not overloaded and the rest of the site kept working without delay.

Near: we had to cancel the tournament | Near: Lichess itself was not overloaded

Fix

Various changes to the queue code had already been made on the master branch when the post was written; it does not say what they were. In progress: looking at optimisations that empty the queue faster and possibly let some events be processed outside the queue, in parallel. Planned: resume the tournament from the last unaffected standings with the remaining tournament time, depending on agadmator's wishes and the scheduling of top level over-the-board events.

Near: we already made various changes on the master | Near: looking at optimizations that will make the queue | Near: resume the tournament with the last unaffected standings

Decision#d1

Process each tournament's state changes one at a time through a per-tournament queue

lichess-2021-tournament-queue#d1 at corpus version 26a1b3a7e3dd
Chosen

Events that affect a tournament's state are put in a queue and processed one at a time for that tournament. Different tournaments have separate queues that run in parallel.

Section: Can you elaborate on the technical issue?

Reasoning

Processing one event at a time per tournament avoids race conditions and keeps the tournament state consistent.

Near: to avoid race conditions | Near: processed one by one for consistency

Cost

The queue of one tournament cannot be parallelised. When the players of a single tournament produced events faster than the queue drained, Lichess could not keep up although it had resources to spare; the same number of players spread over several tournaments would, it says, have been handled smoothly.

Near: the queue of a single tournament cannot be | Near: spread over multiple tournaments

Review

Extracted by
Claude (feed 30)
Human review
Not started. Status recorded on 2026-12-02.