2 ms·
This program finds the problem not because TLA+ is nifty, but because it sweeps out the parameter space, which is exactly what the original Go program should ha
by jeffbee 6y ago
This program finds the problem not because TLA+ is nifty, but because it sweeps out the parameter space, which is exactly what the original Go program should have done in a unit test. What happens when `len(pss)` is just below, at, or just above, or way above `concurrencyProcesses`? That is the type of question that unit tests are supposed to address. Go has a perfectly good deadlock detector.
The real problem cannot be solved by re-modelling in a different high-level language, because the real problem with that code is it gets `pss` from a library call and `concurrencyProcesses` from a global variable, when they should both be function parameters a test case can exercise.
- guessmyname 6y agoThis is why I invest more time Fuzzing [1] than writing software models or formal specifications. Google’s gofuzz [2] and dvyukov’s go-fuzz [3] libraries have been instrumental for my success every time I embark on a journey to write a complex system with concurrency in its heart. The list of bugs I have found in my co-workers programs was so big we decided to spend a month configuring the fuzzing tests and our continuous integration environment to do it automatically. Code quality increased by an order of magnitude and we are now more confident about the code we ship to production. [1] https://en.wikipedia.org/wiki/Fuzzing https://en.wikipedia.org/wiki/Fuzzing [2] https://github.com/google/gofuzz https://github.com/google/gofuzz [3] https://github.com/dvyukov/go-fuzz https://github.com/dvyukov/go-fuzz
- justsomeuser 6y agoOnce you have enough variables you would not be able to write enough unit tests to ensure every safety property of your design. TLA is math, not a typical programming language.