Hi Folks, Just FYI: I've added support for both Address and Thread Sanitizer to the Qpid Dispatch Router CTest suite on the master branch [0][1].
The AddressSanitizer is a tool than instruments both compile-time and runtime checking for various memory related bugs. This includes leak checking, use after free detection, buffer overrun detection, and a whole lot more. See the AddressSanitizer Wiki <https://github.com/google/sanitizers/wiki/AddressSanitizer> for a complete description of its capabilities. The ThreadSanitizer is a data race detection tool. It flags concurrency issues at runtime. See the ThreadSanitizer <https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual> page for more information. By default both of these sanitizers are turned off. You can enable them using the RUNTIME_CHECK build flag. To turn on the AddressSanitizer set the RUNTIME_CHECK flag to 'asan'. To turn on the ThreadSanitizer set the RUNTIME_CHECK flag to 'tsan'. For example, to enable the AddressSanitizer: $ cmake .. -DRUNTIME_CHECK=asan See the top level README file for build instructions. Note that these sanitizers are mutually exclusive - you can turn on either but not both at the same time. Once enabled the CTest suite will run under the specified sanitizer. Errors detected by the sanitizer will result in a test failure and a description of the flaw will be displayed. Both tools provide a way to suppress errors on a case by case basis. The suppression files can be found in the 'tests' subdirectory: 'lsan.supp' for leak errors, 'tsan.supp' for threading errors, and 'asan.supp' for non-leak memory errors. Currently there are a number of suppressed errors in both of these files which need to be investigated and fixed. The advantage these sanitizers have over similar functionality provided by Valgrind is that the sanitizers run MUCH faster. For example on my development machine the AddressSanitizer adds about 4 minutes to a full CTest run (total time ~23 minutes). Running the same suite under Valgrind memcheck takes over an hour in comparison. I've enabled the AddressSanitizer as part of the Travis test matrix. I plan to add an additional Travis job for the ThreadSanitizer shortly. Caveats: 1) ThreadSanitizer currently requires a great deal of memory to run the CTest suite. Under investigation. 2) Neither sanitizer can currently run within a Container. Bare metal and Virtual Machines work fine. Also TBD. 3) I've only tested as far back as GCC 5.4 on Xenial. 4) You'll need to install the libasan, libtsan, and libubsan shared libraries as described in the top level README file. thanks, [0] DISPATCH-1467 <https://issues.apache.org/jira/browse/DISPATCH-1467> [1] DISPATCH-1450 <https://issues.apache.org/jira/browse/DISPATCH-1450> -- -K
