{"id":937,"kind":"story","title":"A developer's notes on building a debugger that reproduces even thread execution order with Nix","url":"https://fzakaria.com/2026/10/07/nix-wrote-half-of-my-debugger","host":"fzakaria.com","by":"startupxo","score":0,"comments":0,"time":"2026-10-10T22:30:13.113Z","origin":"curated","language":{"source":"ko","reading":"en","translated":true},"summary":["The original author runs Nix builds on Rewind, a deterministic virtual machine, to find race condition bugs. The key point is that with the same input, even the thread execution order is reproduced identically.","Nix derivation builds treat the source, compiler, libraries, and configuration as explicit inputs. The author explains that this let others receive the execution records and the information the debugger needs in the same way.","According to the original, nixpkgs stores debug information on cache.nixos.org, and debuginfod fetches symbols and sources by build ID. The author claims this approach lets him check even the Linux kernel source.","The example program, bank, has a bug where two threads overwrite the same balance and money is lost. In the author's measurement on a laptop with 16 cores, losses occurred in 396 of 1,000 runs, and when pinned to a single core, they never occurred."],"discussion":"https://startupxo.com/en/937/","markdown":"https://startupxo.com/en/937.md","api":"https://startupxo.com/api/v1/item.json?id=937&lang=en","text":null,"edited":null,"sources":[{"site":"hn","name":"Hacker News","url":"https://news.ycombinator.com/item?id=50017247","score":172,"comments":37,"observed_at":"2026-10-11T06:44:58Z"}],"thread":[]}