Hacker News new | ask | show | jobs
by nwtnni 12 days ago
The most subtle bug I've been able to reproduce with shuttle-based testing is [this race in Node47](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...), with [this test](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...). I did run into some issues trying to compose proptest with shuttle, i.e., writing a test that exercises both random inputs and random interleavings on that input.

For non-concurrent code, the [state machine tests](https://github.com/nwtnni/arctic/blob/efad26c696f28cfdbeec11...) comparing arctic against std::collections::BTreeMap was invaluable for finding edge cases.

> I've always been curious whether there was a way to specify the behavior of a concurrent data structure in something like an LTL to prove it correct without having to implement a reference implementation or write an invariant checker.

I've toyed with [Alloy](https://alloytools.org/) to verify a small piece of lock-free code in the past, but am no expert. I think verification of lock-free data structures (esp. under weak memory models) is an area of active research.