Zenoh's put is fire-and-forget, get isn't — a read-after-write race in Elixir A developer experimenting with Zenoh's Elixir bindings, Zenohex, discovered a read-after-write race condition where a put followed immediately by a get occasionally returns stale data. The issue stems from Zenoh's put being fire-and-forget, only waiting for the local publish to be queued, while get waits for a remote reply. The developer proposes a wrapper that retries the get until the written payload is confirmed, and notes an open Zenoh issue tracking the same gap. This English version is an AI translation of my original article on Qiita in Japanese https://qiita.com/kikuyuta/items/578bceafe60b4bb53d31 . I've been experimenting with Zenoh https://zenoh.io via its Elixir bindings, Zenohex https://hex.pm/packages/zenohex , not for its usual pub/sub use case but for its put / get storage feature. It mostly worked, except every so the state I picked back up was one step behind. Digging into why turned into a fun rabbit hole, so here's the writeup. To keep things simple, strip out the GenServer part entirely and just loop put immediately followed by get on the same key: php {:ok, session id} = Zenohex.Session.open config Enum.each 1..2000, fn i - payload = Integer.to string i :ok = Zenohex.Session.put session id, key, payload {:ok, replies} = Zenohex.Session.get session id, key, 3 000, consolidation: :latest case Enum.find replies, &match? %Zenohex.Sample{}, &1 do %Zenohex.Sample{payload: ^payload} - :ok %Zenohex.Sample{payload: other} - IO.puts "stale put {payload} but got {other}" nil - IO.puts "no reply at all" end end Out of 2000 iterations, a small fraction print stale — about 78 3.9% in one run. The interesting part: querying again immediately afterward almost always returns the correct value the fastest I measured was a single extra get about 1ms later . So it's not that the value disappears — there's just a small window of lag before the write is actually visible. Zenohex.Session.put/4 is a thin Rustler wrapper around zenoh-rust's put . Looking at the NIF implementation https://github.com/biyooon-ex/zenohex/blob/main/native/zenohex nif/src/session.rs : php fn session put ... - rustler::NifResult