---
title: "Discussion on \"A lock-free queue, broken on purpose to prove it works\" | Hashnode"
description: "Discussion on \"A lock-free queue, broken on purpose to prove it works\". Building AgentXDP, part 8. Part 7 built the histogram that the kernel and the agent fill the same way. This part builds the road events take inside the agent: a queue between two threads, with no lock"
url: "https://hashnode.com/posts/a-lock-free-queue-broken-on-purpose-to-prove-it-works/6ae14fb46a57529b5756a1a3"
---

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

Discussion

# [A lock-free queue, broken on purpose to prove it works](https://pegasus-nathanael-tech.hashnode.dev/a-lock-free-queue-broken-on-purpose-to-prove-it-works?utm_source=hashnode&utm_medium=feed)

Building AgentXDP, part 8. Part 7 built the histogram that the kernel and the agent fill the same way. This part builds the road events take inside the agent: a queue between two threads, with no lock

Oct 28 · 4 min read · pegasus-nathanael-tech.hashnode.dev  
Updated Nov 1  
Read the article

-   [#ebpf](https://hashnode.com/tag/ebpf)
-   [#build-in-public](https://hashnode.com/tag/build-in-public)
-   [#opensource](https://hashnode.com/tag/opensource)
-   [#gpu](https://hashnode.com/tag/gpu)
-   [#gray-faillure](https://hashnode.com/tag/gray-faillure)

## Written by

[Nathanael FETUE](https://hashnode.com/@nathanael-fetue)

@nathanael-fetue · Toulouse

  
[View profile](https://hashnode.com/@nathanael-fetue)

Systems engineer: performance, networks and AI infrastructure | ENSEEIHT graduate

Hi, I'm Nathanael, an ENSEEIHT MSc graduate working on systems and low-level performance. At INRIA, I designed hardware isolation for UPMEM's processing-in-memory processor (at most 5.54% overhead vs 26–120% in software). I now build AgentXDP, an open-source C++/eBPF agent for AI cluster networks. Looking for my first role in systems, performance or AI infrastructure. Contact: nathanaelfetuefoko@gmail.com | linkedin.com/in/nathanael-fetue-foko

## Responses 2

Markdown supported · ⌘↵ to post

[OneLifeVibe](https://hashnode.com/@onelifevibe)

[Nov 7](https://hashnode.com/posts/a-lock-free-queue-broken-on-purpose-to-prove-it-works/6ae14fb46a57529b5756a1a3/comment/6aeec79ddc68ccee77d3e080)

Deliberately breaking the queue to prove the test setup works is the part of this I keep coming back to. Swapping one release for relaxed and watching every assertion still pass while only ThreadSanitizer catches it is a much stronger argument for the tooling than any passing test suite could be — it shows the tests can actually detect the failure mode they exist for. The third-reader depth bug was the other detail that stood out: reading tail then head and getting a subtraction that wraps to nearly 2^64 is exactly the kind of bug that only shows up when a third thread observes two moving indices, and the head-first ordering plus clamping is a clean fix. Same with the hanging test — a consumer assertion failure leaving the producer spinning forever is a failure mode that is easy to miss until it happens in CI. And I appreciate the honesty at the end about claiming correctness, not speed: holding the throughput question open rather than implying the lock-free design is already faster makes the whole series easier to trust.

[Nathanael FETUE](https://hashnode.com/@nathanael-fetue)

[Nov 9](https://hashnode.com/posts/a-lock-free-queue-broken-on-purpose-to-prove-it-works/6ae14fb46a57529b5756a1a3/comment/6aeec79ddc68ccee77d3e080#reply-6af15c1abf36fdf837b4963d)

> Thanks, you picked the three parts that taught me the most. The third reader surprised me: two threads' guarantees don't carry over to a third, so it needed its own reasoning. And the speed question stays open on purpose. No number until there's a benchmark behind it, and TSan doesn't replace a model checker either.
