Comment #9 on issue 81 by
tlip...@gmail.com: False lock-order-inversion
I agree that in general, it's best to optimize to avoid false positives.
The reason that the "single-threaded deadlocks" are useful is just what the
earlier commenter mentioned. We run the tool on our unit test suite, and
often times unit tests don't generate enough multi-threaded concurrency to
cause thread pools to exercise multiple threads in places like RPC handler
pools.
Another case I've found is that, even though today the code might be safe,
it's still the case that different methods are taking a pair of locks in
inverted order. If the code changes a bit in the future (or users call
library methods differently than the unit tests) then you are likely to hit
a deadlock. It's generally a best practice to have a strict specified order
of locks, and deviation from it is a code smell which many teams would want
to eliminate early on.
So, I think it's best to allow a global setting, and also allow
suppressions. Then, in many projects it's feasible to enable the global
setting and either fix or suppress the few false positives that come out.
If a project uses lots and lots of dependencies that exhibit this sort of
problem, they can disable the reporting of single-threaded deadlocks.