Bug #83639 TSAN: data race in my_timer_microseconds
Submitted: 1 Nov 2016 13:54 Modified: 8 Nov 2016 14:14
Reporter: Jon Olav Hauglid Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.0.1 OS:Any
Assigned to: CPU Architecture:Any

[1 Nov 2016 13:54] Jon Olav Hauglid
Description:
Running e.g. main.alter_table with ThreadSanitizer gives:

WARNING: ThreadSanitizer: data race (pid=31643)
  Write of size 8 at 0x000004b1d088 by thread T29:
    #0 my_timer_microseconds /export/home/repo/mysql-ubsan/mysys/my_rdtsc.cc:239 (mysqld+0x00000263ca10)
    #1 get_timer_raw_value_and_function(enum_timer_name, unsigned long long (**)()) /export/home/repo/mysql-ubsan/storage/perfschema/pfs_timer.cc:265 (mysqld+0x000002549adf)
    #2 pfs_start_idle_wait_v1 /export/home/repo/mysql-ubsan/storage/perfschema/pfs.cc:4086 (mysqld+0x0000025140f5)
    #3 inline_mysql_start_idle_wait(PSI_idle_locker_state_v1*, char const*, int) /export/home/repo/mysql-ubsan/include/mysql/psi/mysql_idle.h:79 (mysqld+0x000001880575)
    #4 net_before_header_psi(st_net*, void*, unsigned long) /export/home/repo/mysql-ubsan/sql/conn_handler/init_net_server_extension.cc:60 (mysqld+0x00000188032d)
    #5 net_read_packet_header(st_net*) /export/home/repo/mysql-ubsan/sql/net_serv.cc:850 (mysqld+0x000001ed9206)
    #6 net_read_packet(st_net*, unsigned long*) /export/home/repo/mysql-ubsan/sql/net_serv.cc:917 (mysqld+0x000001ed8cdc)
    #7 my_net_read /export/home/repo/mysql-ubsan/sql/net_serv.cc:990 (mysqld+0x000001ed88b7)
    #8 Protocol_classic::read_packet() /export/home/repo/mysql-ubsan/sql/protocol_classic.cc:1250 (mysqld+0x000001f0c8b1)
    #9 Protocol_classic::get_command(COM_DATA*, enum_server_command*) /export/home/repo/mysql-ubsan/sql/protocol_classic.cc:1401 (mysqld+0x000001f0cef3)
    #10 do_command(THD*) /export/home/repo/mysql-ubsan/sql/sql_parse.cc:1043 (mysqld+0x00000157ffff)
    #11 handle_connection(void*) /export/home/repo/mysql-ubsan/sql/conn_handler/connection_handler_per_thread.cc:323 (mysqld+0x00000187ad63)
    #12 pfs_spawn_thread(void*) /export/home/repo/mysql-ubsan/storage/perfschema/pfs.cc:2363 (mysqld+0x0000025103f7)

  Previous write of size 8 at 0x000004b1d088 by thread T28:
    #0 my_timer_microseconds /export/home/repo/mysql-ubsan/mysys/my_rdtsc.cc:239 (mysqld+0x00000263ca10)
    #1 get_timer_raw_value_and_function(enum_timer_name, unsigned long long (**)()) /export/home/repo/mysql-ubsan/storage/perfschema/pfs_timer.cc:265 (mysqld+0x000002549adf)
    #2 pfs_start_idle_wait_v1 /export/home/repo/mysql-ubsan/storage/perfschema/pfs.cc:4086 (mysqld+0x0000025140f5)
    #3 inline_mysql_start_idle_wait(PSI_idle_locker_state_v1*, char const*, int) /export/home/repo/mysql-ubsan/include/mysql/psi/mysql_idle.h:79 (mysqld+0x000001880575)
    #4 net_before_header_psi(st_net*, void*, unsigned long) /export/home/repo/mysql-ubsan/sql/conn_handler/init_net_server_extension.cc:60 (mysqld+0x00000188032d)
    #5 net_read_packet_header(st_net*) /export/home/repo/mysql-ubsan/sql/net_serv.cc:850 (mysqld+0x000001ed9206)
    #6 net_read_packet(st_net*, unsigned long*) /export/home/repo/mysql-ubsan/sql/net_serv.cc:917 (mysqld+0x000001ed8cdc)
    #7 my_net_read /export/home/repo/mysql-ubsan/sql/net_serv.cc:990 (mysqld+0x000001ed88b7)
    #8 Protocol_classic::read_packet() /export/home/repo/mysql-ubsan/sql/protocol_classic.cc:1250 (mysqld+0x000001f0c8b1)
    #9 Protocol_classic::get_command(COM_DATA*, enum_server_command*) /export/home/repo/mysql-ubsan/sql/protocol_classic.cc:1401 (mysqld+0x000001f0cef3)
    #10 do_command(THD*) /export/home/repo/mysql-ubsan/sql/sql_parse.cc:1043 (mysqld+0x00000157ffff)
    #11 handle_connection(void*) /export/home/repo/mysql-ubsan/sql/conn_handler/connection_handler_per_thread.cc:323 (mysqld+0x00000187ad63)
    #12 pfs_spawn_thread(void*) /export/home/repo/mysql-ubsan/storage/perfschema/pfs.cc:2363 (mysqld+0x0000025103f7)

How to repeat:
main.alter_table with ThreadSanitizer
[8 Nov 2016 14:14] Paul DuBois
Posted by developer:
 
Fixed in 8.0.1.

Bug affects no released versions. No changelog entry needed.