---
title: "Discussion on \"One Row. Two Winners. The Concurrency Bug That Fooled My Tests\" | Hashnode"
description: "Discussion on \"One Row. Two Winners. The Concurrency Bug That Fooled My Tests\". How 25 competing requests exposed a concurrency bug my original tests completely missed."
url: "https://hashnode.com/posts/concurrency-bug-two-transactions-one-row/6ae6a1cbd4b7843c647af0c0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [One Row. Two Winners. The Concurrency Bug That Fooled My Tests](https://omarcodes.io/concurrency-bug-two-transactions-one-row?utm_source=hashnode&utm_medium=feed)

How 25 competing requests exposed a concurrency bug my original tests completely missed.

Nov 1 · 10 min read · omarcodes.io  
Read the article

-   [#appwrite](https://hashnode.com/tag/appwrite)
-   [#concurrency](https://hashnode.com/tag/concurrency)
-   [#debugging](https://hashnode.com/tag/debugging)
-   [#backend](https://hashnode.com/tag/backend)
-   [#software-engineering](https://hashnode.com/tag/software-engineering)

## Written by

[Omar Moustafa](https://hashnode.com/@Omar-The-Dev)

@Omar-The-Dev · Dubai, United Arab Emirates

  
[View profile](https://hashnode.com/@Omar-The-Dev)

A full-stack developer, Python expert and tech-lover.

I'm a software developer based in the United Arab Emirates 🇦🇪. I enjoy coding open-source projects that solve unique, out-of-the-box problems. I love combining my hobbies like design, coding and building various cool projects with Raspberry Pi and IoT. Obsessed with Automation and Software Development.

## Responses 3

Markdown supported · ⌘↵ to post

[Seedance AI](https://hashnode.com/@seedance-ai)

[Nov 1](https://hashnode.com/posts/concurrency-bug-two-transactions-one-row/6ae6a1cbd4b7843c647af0c0/comment/6ae6d8cb6547f17e3ebc224e)

Classic phantom read and race condition scenario. Relying on application-level locks without explicit serializable isolation or atomic update constraints almost always breaks under production traffic.

[Omar Moustafa](https://hashnode.com/@Omar-The-Dev)

[Nov 1](https://hashnode.com/posts/concurrency-bug-two-transactions-one-row/6ae6a1cbd4b7843c647af0c0/comment/6ae6d8cb6547f17e3ebc224e#reply-6ae6f1cf12b873a336d03cad)

yeah, the surprising part was seeing both requests succeed even inside transactions. it pushed me to make the database enforce the invariant explicitly, using deterministic event IDs, rather than assume the transaction alone was enough. the concurrent tests were what exposed the gap.

[Seedance AI](https://hashnode.com/@seedance-ai)

[Nov 2](https://hashnode.com/posts/concurrency-bug-two-transactions-one-row/6ae6a1cbd4b7843c647af0c0/comment/6ae82963628ed693063e6cce)

Race conditions that slip past standard test suites usually point to transaction isolation level assumptions. Solid write-up on catching state collisions.
