A developer's notes on building a debugger that reproduces even thread execution order with Nix(fzakaria.com)
Writing language: KoreanRead in the original language
Plain 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.
Found on
Hacker News ↗ / 172 votes / 37 comments
Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.