Bug #80409 support the thread sanitizer
Submitted: 17 Feb 2016 13:55 Modified: 27 Jun 2016 13:19
Reporter: Richard Prohaska Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S4 (Feature request)
Version:5.7.11 or later OS:Ubuntu (ubuntu 15.10)
Assigned to: CPU Architecture:Any

[17 Feb 2016 13:55] Richard Prohaska
Description:
The thread sanitizer finds bugs in multi-threaded programs like the mysql server.  The mysql build process currently supports the address sanitizer.  Unfortunately, the thread sanitizer is not supported.  I hacked the mysql 5.7 build process to support the thread sanitizer and used the provided mysql tests to find bugs in the mysql server.

See the following blog posts for details on bugs found in mysql 5.7 by the thread sanitizer:
http://prohaska7.blogspot.com/2015/12/mysql-57-initialization-versus-thread.html
http://prohaska7.blogspot.com/2015/12/mysql-57-performance-schema-versus.html
http://prohaska7.blogspot.com/2015/12/mysql-57-innodb-versus-thread-sanitizer.html

How to repeat:
Since mysql does not currently support this cmake flag, cmake -DWITH_TSAN=ON will fail.

Suggested fix:
I added a cmake variable called WITH_TSAN to compile mysql with the thread sanitizer.  The implementation of WITH_TSAN follows the implementation of WITH_ASAN and the other sanitizers.

See this github commit:
https://github.com/prohaska7/mysql-server/commit/11ff9ee802894723bf7ae4d34e00b181df9bd839
[25 Apr 2016 7:51] MySQL Verification Team
Hello  Richard Prohaska,

Thank you for the reasonable feature request!
I see you have already created a patch for this, may I request you to please submit your patch as contribution so that it can be used? In order to submit contributions you must first sign the Oracle Contribution Agreement (OCA).
For additional information please check http://www.oracle.com/technetwork/community/oca-486395.html.
If you have any questions, please contact the MySQL community team.

Thank you once again!

Thanks,
Umesh
[27 Jun 2016 13:19] Paul DuBois
Posted by developer:
 
Noted in 8.0.0 changelog.

A new CMake option, WITH_TSAN, permits enabling ThreadSanitizer for
compilers that support it.