{
  "id": 14416450,
  "title": "Two phones at the same table pressed Join in the same moment, and the loser was told the quiz did not exist",
  "url": "https://urgent.news/2026/10/14/two-phones-at-the-same-table-pressed-join-in-the-same-moment-and-the",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-14T09:41:22.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/daniel_pertu/two-phones-at-the-same-table-pressed-join-in-the-same-moment-and-the-loser-was-told-the-quiz-did-1l5p"
  },
  "original_language": "en",
  "account": "In the event of a PubTrivia quiz, players join by scanning a code, typing their name, and pressing the Join button. The trivia game does not require players to have an account, which simplifies the process. This design choice eliminates the need for users to install anything on their devices, as the conversion rate for doing so is virtually zero.\n\nEach player is represented as a row in the table_participants table, with the primary key being the only means of identifying them. The identity is stored in the browser's localStorage, keyed by the table type and the player's unique identifier. This information is saved using a function that handles potential localStorage errors, such as when the browser is in private browsing mode.\n\nThe join process involves three rules, each requiring a read followed by a write operation. These rules include ensuring unique player names within a session, case-insensitive uniqueness, and allowing only one row per table during team play. If these rules are violated, specific error messages are generated, informing the player of the issue.\n\nTwo phones at the same table pressing Join at the same moment can lead to a race condition, where both phones read the database as having no row for the table, insert a new player record, and then encounter a partial unique index violation on the leaderboard. This results in the second person being told that the session does not exist, even though it does. The issue lies in the lack of a transaction-scoped advisory lock, which would prevent concurrent inserts and provide a more accurate outcome.",
  "summary": "Nobody who plays a quiz on PubTrivia has an account. They scan the code on their table, type a name, and they are in. That is deliberate, because the alternative is asking six people in a pub to install something, and the honest conversion rate on that is zero. Which leaves the question every anonymous multiplayer thing has to answer: what is a player, if not a user? Here, a player is a row in…",
  "key_points": [
    "Two phones attempted to join the same PubTrivia session simultaneously.",
    "Race condition caused both phones to be denied entry to the quiz.",
    "Advisory lock could prevent concurrent inserts in future quizzes."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}