FBInfer reduced our product crash by 50%
Just want to share how powerful this tool is. Infer, or FBInfer (since it's written by Facebook), is a static analyzer that can detect cross-function logic errors and potential data race in C, C++ and Objective-C. Which is just amazing.
The company I work for runs on a C++ heavy product. Unfortunatelly we run into crashes. At it's worst our analytics shows that the crash free rate is 86%. Which is unacceptable. (I know we all hate analytics, but we can't fix problems without knowing where it crashed). Gradually we patched more and more issues and the crash free rate raised to 91%. But then the remaining bugs makes no sense at all. Stack trace is a total wack. Nor we can reproduce them internally.
Yet, we get a lot of costumer complaints about crashing. At this point we tried all the more traditional options to surface problems on our environment. AddressSanitizer, valgrind and Dr.Memory. Non of them catched anything. Presumably, we misses some rare error handling or race conditions. I also tried CppCheck but again, nothing really popped up.
I ran Infer over our codebase out ob frustration. Wow it warns about many possible null dereference and uninitialized values (surprisingly no races). We gone through the warnings one by one. Patached and merged that into a new release. WOW..!! our crash free rate is now 96.1%! Sure that number includes some other improvments. But still, wow..
How to use
This section should be reduncdent as everthing is on their docs and does a better job at explaining. I'll just show you the simplest way. Given any CMake project. You can export
compile_commands.json by setting the
CMAKE_EXPORT_COMPILE_COMMANDS variable from CLI. Then just point infer to it and wait.
$ cd build $ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. $ cd .. $ infer run --compilation-database build/compile_commands.json
That's it. A report will be generated in
Systems software, HPC, GPGPU and AI. I mostly write stupid C++ code. Sometimes does AI research. Chronic VRChat addict
- marty1885 \at protonmail.com
- Matrix: @clehaxze:matrix.clehaxze.tw
- Jami: a72b62ac04a958ca57739247aa1ed4fe0d11d2df