Both gcc 6.1 and clang 3.9 support the thread sanitizer. Just add the 'WITH_TSAN=ON' cmake option when configuring and building MySQL 8.0, and the MySQL code will be compiled with the thread sanitizer.
The next step after building MySQL is to run some MySQL tests. Unfortunately, MySQL tests need to bootstrap the MySQL data directory, and there are lots of thread sanitizer issues during the bootstrap that prohibit the bootstrap to succeed. This means that no MySQL tests can be run until these issues are fixed or suppressed. MySQL 8.0 does not include a basic suppression file for the thread sanitizer as it does for the address sanitizer and for valgrind. So, how many suppressions are needed to get a simple test to run? The answer is about 4 or 5 suppressions (see below). The problem is that the InnoDB suppression covers ANY data race in the InnoDB storage engine. Since InnoDB is the primary storage engine for MySQL, this is not acceptable. I hope that the InnoDB developers address this.
I used the following thread sanitizer suppressions when running the main and InnoDB MySQL test suites. Anyone interesting in using the thread sanitizer to find bugs in MySQL 8.0 software can use these suppressions as a starting point in their investigation. Good luck!
# ignore races in the pthread barrier implementation
race:pthread_barrier
# ignore possible locking deadlock
deadlock:plugin_thdvar_init
# ignore all races in the innodb storage engine. this is overkill
race:innobase
# ignore races in the perf schema
race:^pfs
race:^PFS
# ignore race on charsets_dir
race:^charsets_dir$
# ignore race on THR_KEY_mysys_initialized. should be an atomic variable
race:^THR_KEY_mysys_initialized$
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete