Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24332

Data race in os_file_pread at os/os0file.cc:3310, :3311, :3313

    XMLWordPrintable

    Details

      Description

      Simply starting or shutting down the server (both optimized and debug) generates various data races in os_file_pread:

      10.5.9 1435f35bdabd078f0c4e744ab4bdfd8d4acca3ea (Optimized)

      ... startup ...
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3310 in os_file_pread
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 in os_file_pread
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3313 in os_file_pread
      ... shutdown ...
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3310 in os_file_pread
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 in os_file_pread
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3313 in os_file_pread
      

      10.5.9 1435f35bdabd078f0c4e744ab4bdfd8d4acca3ea (Optimized)

      WARNING: ThreadSanitizer: data race (pid=2702489)
        Read of size 8 at 0x5574f389be70 by thread T7:
          #0 os_file_pread /test/10.5_opt_san/storage/innobase/os/os0file.cc:3310 (mariadbd+0x140eaac)
          #1 os_file_read_page /test/10.5_opt_san/storage/innobase/os/os0file.cc:3345 (mariadbd+0x140eaac)
          #2 os_file_read_func(IORequest const&, int, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:3730 (mariadbd+0x140ffbf)
          #3 os_aio(IORequest const&, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:4117 (mariadbd+0x140ffbf)
          #4 fil_space_t::io(IORequest const&, unsigned long, unsigned long, void*, buf_page_t*) /test/10.5_opt_san/storage/innobase/fil/fil0fil.cc:3431 (mariadbd+0x1634a88)
          #5 buf_read_page_low /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:344 (mariadbd+0x15d2183)
          #6 buf_read_page_background(fil_space_t*, page_id_t, unsigned long, bool) /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:510 (mariadbd+0x15d2183)
          #7 buf_load /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:677 (mariadbd+0x15c2622)
          #8 buf_dump_load_func /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:758 (mariadbd+0x15c31e1)
          #9 tpool::task::execute() /test/10.5_opt_san/tpool/task.cc:52 (mariadbd+0x16f48df)
          #10 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.5_opt_san/tpool/tpool_generic.cc:546 (mariadbd+0x16f1b54)
          #11 void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:73 (mariadbd+0x16f2a47)
          #12 std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:95 (mariadbd+0x16f2a47)
          #13 void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/include/c++/9/thread:244 (mariadbd+0x16f2a47)
          #14 std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::operator()() /usr/include/c++/9/thread:251 (mariadbd+0x16f2a47)
          #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> > >::_M_run() /usr/include/c++/9/thread:195 (mariadbd+0x16f2a47)
          #16 <null> <null> (libstdc++.so.6+0xd6d83)
       
        Previous write of size 8 at 0x5574f389be70 by main thread:
          #0 srv_mon_default_on() /test/10.5_opt_san/storage/innobase/srv/srv0mon.cc:2099 (mariadbd+0x14decc1)
          #1 innodb_init /test/10.5_opt_san/storage/innobase/handler/ha_innodb.cc:3961 (mariadbd+0x136065c)
          #2 ha_initialize_handlerton(st_plugin_int*) /test/10.5_opt_san/sql/handler.cc:645 (mariadbd+0xcf9547)
          #3 plugin_initialize /test/10.5_opt_san/sql/sql_plugin.cc:1459 (mariadbd+0x8d3f74)
          #4 plugin_init(int*, char**, int) /test/10.5_opt_san/sql/sql_plugin.cc:1751 (mariadbd+0x8d5cc3)
          #5 init_server_components /test/10.5_opt_san/sql/mysqld.cc:4913 (mariadbd+0x72043d)
          #6 mysqld_main(int, char**) /test/10.5_opt_san/sql/mysqld.cc:5496 (mariadbd+0x725bf4)
          #7 main /test/10.5_opt_san/sql/main.cc:25 (mariadbd+0x6b8455)
       
        Location is global 'monitor_set_tbl' of size 32 at 0x5574f389be60 (mariadbd+0x000002b2ae70)
       
        Thread T7 (tid=2702743, running) created by thread T1 at:
          #0 pthread_create <null> (libtsan.so.0+0x5ea99)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd7048)
          #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.5_opt_san/tpool/tpool_generic.cc:802 (mariadbd+0x16f2787)
          #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.5_opt_san/tpool/tpool_generic.cc:821 (mariadbd+0x16f2787)
          #4 tpool::thread_pool_generic::timer_generic::submit_task(void*) /test/10.5_opt_san/tpool/tpool_generic.cc:335 (mariadbd+0x16f28c9)
          #5 process_timers /test/10.5_opt_san/mysys/thr_timer.c:271 (mariadbd+0x17b289b)
          #6 timer_handler /test/10.5_opt_san/mysys/thr_timer.c:315 (mariadbd+0x17b289b)
          #7 <null> <null> (libtsan.so.0+0x2d1af)
       
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3310 in os_file_pread
      

      10.5.9 1435f35bdabd078f0c4e744ab4bdfd8d4acca3ea (Optimized)

      WARNING: ThreadSanitizer: data race (pid=2702489)
        Atomic write of size 8 at 0x5574f389eef8 by thread T7:
          #0 __tsan_atomic64_fetch_add <null> (libtsan.so.0+0x7f2d9)
          #1 os_file_pread /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 (mariadbd+0x140ec02)
          #2 os_file_read_page /test/10.5_opt_san/storage/innobase/os/os0file.cc:3345 (mariadbd+0x140ec02)
          #3 os_file_read_func(IORequest const&, int, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:3730 (mariadbd+0x140ffbf)
          #4 os_aio(IORequest const&, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:4117 (mariadbd+0x140ffbf)
          #5 fil_space_t::io(IORequest const&, unsigned long, unsigned long, void*, buf_page_t*) /test/10.5_opt_san/storage/innobase/fil/fil0fil.cc:3431 (mariadbd+0x1634a88)
          #6 buf_read_page_low /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:344 (mariadbd+0x15d2183)
          #7 buf_read_page_background(fil_space_t*, page_id_t, unsigned long, bool) /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:510 (mariadbd+0x15d2183)
          #8 buf_load /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:677 (mariadbd+0x15c2622)
          #9 buf_dump_load_func /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:758 (mariadbd+0x15c31e1)
          #10 tpool::task::execute() /test/10.5_opt_san/tpool/task.cc:52 (mariadbd+0x16f48df)
          #11 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.5_opt_san/tpool/tpool_generic.cc:546 (mariadbd+0x16f1b54)
          #12 void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:73 (mariadbd+0x16f2a47)
          #13 std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:95 (mariadbd+0x16f2a47)
          #14 void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/include/c++/9/thread:244 (mariadbd+0x16f2a47)
          #15 std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::operator()() /usr/include/c++/9/thread:251 (mariadbd+0x16f2a47)
          #16 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> > >::_M_run() /usr/include/c++/9/thread:195 (mariadbd+0x16f2a47)
          #17 <null> <null> (libstdc++.so.6+0xd6d83)
       
        Previous write of size 8 at 0x5574f389eef8 by main thread:
          #0 memset <null> (libtsan.so.0+0x3792f)
          #1 memset /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71 (mariadbd+0x1360588)
          #2 innodb_init /test/10.5_opt_san/storage/innobase/handler/ha_innodb.cc:3950 (mariadbd+0x1360588)
          #3 ha_initialize_handlerton(st_plugin_int*) /test/10.5_opt_san/sql/handler.cc:645 (mariadbd+0xcf9547)
          #4 plugin_initialize /test/10.5_opt_san/sql/sql_plugin.cc:1459 (mariadbd+0x8d3f74)
          #5 plugin_init(int*, char**, int) /test/10.5_opt_san/sql/sql_plugin.cc:1751 (mariadbd+0x8d5cc3)
          #6 init_server_components /test/10.5_opt_san/sql/mysqld.cc:4913 (mariadbd+0x72043d)
          #7 mysqld_main(int, char**) /test/10.5_opt_san/sql/mysqld.cc:5496 (mariadbd+0x725bf4)
          #8 main /test/10.5_opt_san/sql/main.cc:25 (mariadbd+0x6b8455)
       
        Location is global 'innodb_counter_value' of size 24480 at 0x5574f389be80 (mariadbd+0x000002b2def8)
       
        Thread T7 (tid=2702743, running) created by thread T1 at:
          #0 pthread_create <null> (libtsan.so.0+0x5ea99)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd7048)
          #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.5_opt_san/tpool/tpool_generic.cc:802 (mariadbd+0x16f2787)
          #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.5_opt_san/tpool/tpool_generic.cc:821 (mariadbd+0x16f2787)
          #4 tpool::thread_pool_generic::timer_generic::submit_task(void*) /test/10.5_opt_san/tpool/tpool_generic.cc:335 (mariadbd+0x16f28c9)
          #5 process_timers /test/10.5_opt_san/mysys/thr_timer.c:271 (mariadbd+0x17b289b)
          #6 timer_handler /test/10.5_opt_san/mysys/thr_timer.c:315 (mariadbd+0x17b289b)
          #7 <null> <null> (libtsan.so.0+0x2d1af)
       
      SUMMARY: ThreadSanitizer: data race (/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x7f2d9) in __tsan_atomic64_fetch_add
      

      ^ Discussing SUMARY's: This is one of the :3311 reports (on both startup and shutdown). Then, there is an actual :3311 one on shutdown. IOW, there is 3 in total: 2x __tsan_atomic64_fetch_add (startup+shutdown) and 1x :3311, as follows:

      10.5.9 1435f35bdabd078f0c4e744ab4bdfd8d4acca3ea (Optimized)

      WARNING: ThreadSanitizer: data race (pid=2769340)
        Read of size 8 at 0x55aa3d60ef00 by thread T7:
          #0 os_file_pread /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 (mariadbd+0x140ec12)
          #1 os_file_read_page /test/10.5_opt_san/storage/innobase/os/os0file.cc:3345 (mariadbd+0x140ec12)
          #2 os_file_read_func(IORequest const&, int, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:3730 (mariadbd+0x140ffbf)
          #3 os_aio(IORequest const&, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:4117 (mariadbd+0x140ffbf)
          #4 fil_space_t::io(IORequest const&, unsigned long, unsigned long, void*, buf_page_t*) /test/10.5_opt_san/storage/innobase/fil/fil0fil.cc:3431 (mariadbd+0x1634a88)
          #5 buf_read_page_low /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:344 (mariadbd+0x15d2183)
          #6 buf_read_page_background(fil_space_t*, page_id_t, unsigned long, bool) /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:510 (mariadbd+0x15d2183)
          #7 buf_load /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:677 (mariadbd+0x15c2622)
          #8 buf_dump_load_func /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:758 (mariadbd+0x15c31e1)
          #9 tpool::task::execute() /test/10.5_opt_san/tpool/task.cc:52 (mariadbd+0x16f48df)
          #10 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.5_opt_san/tpool/tpool_generic.cc:546 (mariadbd+0x16f1b54)
          #11 void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:73 (mariadbd+0x16f2a47)
          #12 std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:95 (mariadbd+0x16f2a47)
          #13 void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/include/c++/9/thread:244 (mariadbd+0x16f2a47)
          #14 std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::operator()() /usr/include/c++/9/thread:251 (mariadbd+0x16f2a47)
          #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> > >::_M_run() /usr/include/c++/9/thread:195 (mariadbd+0x16f2a47)
          #16 <null> <null> (libstdc++.so.6+0xd6d83)
       
        Previous write of size 8 at 0x55aa3d60ef00 by main thread:
          #0 memset <null> (libtsan.so.0+0x3792f)
          #1 memset /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71 (mariadbd+0x1360588)
          #2 innodb_init /test/10.5_opt_san/storage/innobase/handler/ha_innodb.cc:3950 (mariadbd+0x1360588)
          #3 ha_initialize_handlerton(st_plugin_int*) /test/10.5_opt_san/sql/handler.cc:645 (mariadbd+0xcf9547)
          #4 plugin_initialize /test/10.5_opt_san/sql/sql_plugin.cc:1459 (mariadbd+0x8d3f74)
          #5 plugin_init(int*, char**, int) /test/10.5_opt_san/sql/sql_plugin.cc:1751 (mariadbd+0x8d5cc3)
          #6 init_server_components /test/10.5_opt_san/sql/mysqld.cc:4913 (mariadbd+0x72043d)
          #7 mysqld_main(int, char**) /test/10.5_opt_san/sql/mysqld.cc:5496 (mariadbd+0x725bf4)
          #8 main /test/10.5_opt_san/sql/main.cc:25 (mariadbd+0x6b8455)
       
        Location is global 'innodb_counter_value' of size 24480 at 0x55aa3d60be80 (mariadbd+0x000002b2df00)
       
        Thread T7 (tid=2769355, running) created by thread T1 at:
          #0 pthread_create <null> (libtsan.so.0+0x5ea99)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd7048)
          #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.5_opt_san/tpool/tpool_generic.cc:802 (mariadbd+0x16f2787)
          #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.5_opt_san/tpool/tpool_generic.cc:821 (mariadbd+0x16f2787)
          #4 tpool::thread_pool_generic::timer_generic::submit_task(void*) /test/10.5_opt_san/tpool/tpool_generic.cc:335 (mariadbd+0x16f28c9)
          #5 process_timers /test/10.5_opt_san/mysys/thr_timer.c:271 (mariadbd+0x17b289b)
          #6 timer_handler /test/10.5_opt_san/mysys/thr_timer.c:315 (mariadbd+0x17b289b)
          #7 <null> <null> (libtsan.so.0+0x2d1af)
       
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 in os_file_pread
      

      10.5.9 1435f35bdabd078f0c4e744ab4bdfd8d4acca3ea (Optimized)

      WARNING: ThreadSanitizer: data race (pid=2769113)
        Read of size 8 at 0x557e07d6df00 by thread T7:
          #0 os_file_pread /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 (mariadbd+0x140ec12)
          #1 os_file_read_page /test/10.5_opt_san/storage/innobase/os/os0file.cc:3345 (mariadbd+0x140ec12)
          #2 os_file_read_func(IORequest const&, int, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:3730 (mariadbd+0x140ffbf)
          #3 os_aio(IORequest const&, void*, unsigned long, unsigned long) /test/10.5_opt_san/storage/innobase/os/os0file.cc:4117 (mariadbd+0x140ffbf)
          #4 fil_space_t::io(IORequest const&, unsigned long, unsigned long, void*, buf_page_t*) /test/10.5_opt_san/storage/innobase/fil/fil0fil.cc:3431 (mariadbd+0x1634a88)
          #5 buf_read_page_low /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:344 (mariadbd+0x15d2183)
          #6 buf_read_page_background(fil_space_t*, page_id_t, unsigned long, bool) /test/10.5_opt_san/storage/innobase/buf/buf0rea.cc:510 (mariadbd+0x15d2183)
          #7 buf_load /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:677 (mariadbd+0x15c2622)
          #8 buf_dump_load_func /test/10.5_opt_san/storage/innobase/buf/buf0dump.cc:758 (mariadbd+0x15c31e1)
          #9 tpool::task::execute() /test/10.5_opt_san/tpool/task.cc:52 (mariadbd+0x16f48df)
          #10 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.5_opt_san/tpool/tpool_generic.cc:546 (mariadbd+0x16f1b54)
          #11 void std::__invoke_impl<void, void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(std::__invoke_memfun_deref, void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:73 (mariadbd+0x16f2a47)
          #12 std::__invoke_result<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>::type std::__invoke<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*>(void (tpool::thread_pool_generic::*&&)(tpool::worker_data*), tpool::thread_pool_generic*&&, tpool::worker_data*&&) /usr/include/c++/9/bits/invoke.h:95 (mariadbd+0x16f2a47)
          #13 void std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/include/c++/9/thread:244 (mariadbd+0x16f2a47)
          #14 std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> >::operator()() /usr/include/c++/9/thread:251 (mariadbd+0x16f2a47)
          #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (tpool::thread_pool_generic::*)(tpool::worker_data*), tpool::thread_pool_generic*, tpool::worker_data*> > >::_M_run() /usr/include/c++/9/thread:195 (mariadbd+0x16f2a47)
          #16 <null> <null> (libstdc++.so.6+0xd6d83)
       
        Previous write of size 8 at 0x557e07d6df00 by main thread:
          #0 memset <null> (libtsan.so.0+0x3792f)
          #1 memset /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71 (mariadbd+0x1360588)
          #2 innodb_init /test/10.5_opt_san/storage/innobase/handler/ha_innodb.cc:3950 (mariadbd+0x1360588)
          #3 ha_initialize_handlerton(st_plugin_int*) /test/10.5_opt_san/sql/handler.cc:645 (mariadbd+0xcf9547)
          #4 plugin_initialize /test/10.5_opt_san/sql/sql_plugin.cc:1459 (mariadbd+0x8d3f74)
          #5 plugin_init(int*, char**, int) /test/10.5_opt_san/sql/sql_plugin.cc:1751 (mariadbd+0x8d5cc3)
          #6 init_server_components /test/10.5_opt_san/sql/mysqld.cc:4913 (mariadbd+0x72043d)
          #7 mysqld_main(int, char**) /test/10.5_opt_san/sql/mysqld.cc:5496 (mariadbd+0x725bf4)
          #8 main /test/10.5_opt_san/sql/main.cc:25 (mariadbd+0x6b8455)
       
        Location is global 'innodb_counter_value' of size 24480 at 0x557e07d6ae80 (mariadbd+0x000002b2df00)
       
        Thread T7 (tid=2769128, running) created by thread T1 at:
          #0 pthread_create <null> (libtsan.so.0+0x5ea99)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd7048)
          #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.5_opt_san/tpool/tpool_generic.cc:802 (mariadbd+0x16f2787)
          #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.5_opt_san/tpool/tpool_generic.cc:821 (mariadbd+0x16f2787)
          #4 tpool::thread_pool_generic::timer_generic::submit_task(void*) /test/10.5_opt_san/tpool/tpool_generic.cc:335 (mariadbd+0x16f28c9)
          #5 process_timers /test/10.5_opt_san/mysys/thr_timer.c:271 (mariadbd+0x17b289b)
          #6 timer_handler /test/10.5_opt_san/mysys/thr_timer.c:315 (mariadbd+0x17b289b)
          #7 <null> <null> (libtsan.so.0+0x2d1af)
       
      SUMMARY: ThreadSanitizer: data race /test/10.5_opt_san/storage/innobase/os/os0file.cc:3311 in os_file_pread
      

      {
        ut_ad(type.is_read());
        ++os_n_file_reads;
       
        const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS);       <------------- 3310
        MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);          <------------- 3311
        ssize_t n_bytes = os_file_io(type, file, buf, n, offset, err);
        MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);          <------------- 3313
       
        return(n_bytes);
      }
      

      Setup:

      Compiled with GCC >=7.5.0 (I use GCC 9.3.0) and:
          -DWITH_TSAN=ON -DWSREP_LIB_WITH_TSAN=ON -DMUTEXTYPE=sys
      Set before execution:
          export TSAN_OPTIONS=suppress_equal_stacks=1:suppress_equal_addresses=1:history_size=7:verbosity=1:exitcode=0
      

      Bug confirmed present in:
      MariaDB: 10.3.28 (dbg), 10.4.18 (dbg), [_10.4.18 (opt)_], 10.5.9 (dbg), 10.5.9 (opt), 10.6.0 (dbg), 10.6.0 (opt)

      Bug confirmed not present in:
      MariaDB: 10.1.49 (dbg), 10.1.49 (opt), 10.2.37 (dbg), 10.2.37 (opt), 10.3.28 (opt)

      Note: 10.3.28 (opt) has no issues.
      Note: 10.6.0 (dbg) has only a single issue on os/os0file.cc:3313.
      Note: 10.4.0 (opt) has no issues, but has another one on os0file.cc:4987:

      10.4.18 7effcb8ed6a9fd75452535490af425270d6416bf (Optimized)

      WARNING: ThreadSanitizer: data race (pid=2704859)
        Write of size 8 at 0x55c8c5b7e810 by main thread:
          #0 srv_mon_default_on() /test/10.4_opt_san/storage/innobase/srv/srv0mon.cc:2190 (mysqld+0x11a6f81)
          #1 innodb_init /test/10.4_opt_san/storage/innobase/handler/ha_innodb.cc:4262 (mysqld+0x1035644)
          #2 ha_initialize_handlerton(st_plugin_int*) /test/10.4_opt_san/sql/handler.cc:574 (mysqld+0xc665d5)
          #3 plugin_initialize /test/10.4_opt_san/sql/sql_plugin.cc:1438 (mysqld+0x81b304)
          #4 plugin_init(int*, char**, int) /test/10.4_opt_san/sql/sql_plugin.cc:1720 (mysqld+0x81d125)
          #5 init_server_components /test/10.4_opt_san/sql/mysqld.cc:5218 (mysqld+0x66f974)
          #6 mysqld_main(int, char**) /test/10.4_opt_san/sql/mysqld.cc:5747 (mysqld+0x6767d4)
          #7 main /test/10.4_opt_san/sql/main.cc:25 (mysqld+0x63a245)
       
        Previous read of size 8 at 0x55c8c5b7e810 by thread T25:
          #0 os_file_pread /test/10.4_opt_san/storage/innobase/os/os0file.cc:4987 (mysqld+0x10e16bc)
          #1 os_file_read_page /test/10.4_opt_san/storage/innobase/os/os0file.cc:5023 (mysqld+0x10e16bc)
          #2 os_file_read_func(IORequest const&, int, void*, unsigned long, unsigned long) /test/10.4_opt_san/storage/innobase/os/os0file.cc:5414 (mysqld+0x10e1efd)
          #3 os_aio_func(IORequest&, unsigned long, char const*, pfs_os_file_t, void*, unsigned long, unsigned long, bool, fil_node_t*, void*) /test/10.4_opt_san/storage/innobase/os/os0file.cc:6594 (mysqld+0x10e1efd)
          #4 pfs_os_aio_func /test/10.4_opt_san/storage/innobase/include/os0file.ic:253 (mysqld+0x12ebfcb)
          #5 fil_io(IORequest const&, bool, page_id_t, unsigned long, unsigned long, unsigned long, void*, void*, bool) /test/10.4_opt_san/storage/innobase/fil/fil0fil.cc:4271 (mysqld+0x12ebfcb)
          #6 buf_read_page_low /test/10.4_opt_san/storage/innobase/buf/buf0rea.cc:181 (mysqld+0x1283a2d)
          #7 buf_read_page_background(page_id_t, unsigned long, bool) /test/10.4_opt_san/storage/innobase/buf/buf0rea.cc:418 (mysqld+0x128416d)
          #8 buf_load /test/10.4_opt_san/storage/innobase/buf/buf0dump.cc:718 (mysqld+0x126f0cb)
          #9 buf_dump_thread /test/10.4_opt_san/storage/innobase/buf/buf0dump.cc:824 (mysqld+0x126fa52)
          #10 <null> <null> (libtsan.so.0+0x2d1af)
       
        Location is global 'monitor_set_tbl' of size 40 at 0x55c8c5b7e800 (mysqld+0x0000020a8810)
       
        Thread T25 (tid=2705107, running) created by main thread at:
          #0 pthread_create <null> (libtsan.so.0+0x5ea99)
          #1 os_thread_create_func(void* (*)(void*), void*, unsigned long*) /test/10.4_opt_san/storage/innobase/os/os0thread.cc:138 (mysqld+0x10e75b1)
          #2 srv_start(bool) /test/10.4_opt_san/storage/innobase/srv/srv0start.cc:2380 (mysqld+0x5f1ff7)
          #3 innodb_init /test/10.4_opt_san/storage/innobase/handler/ha_innodb.cc:4214 (mysqld+0x10352a0)
          #4 ha_initialize_handlerton(st_plugin_int*) /test/10.4_opt_san/sql/handler.cc:574 (mysqld+0xc665d5)
          #5 plugin_initialize /test/10.4_opt_san/sql/sql_plugin.cc:1438 (mysqld+0x81b304)
          #6 plugin_init(int*, char**, int) /test/10.4_opt_san/sql/sql_plugin.cc:1720 (mysqld+0x81d125)
          #7 init_server_components /test/10.4_opt_san/sql/mysqld.cc:5218 (mysqld+0x66f974)
          #8 mysqld_main(int, char**) /test/10.4_opt_san/sql/mysqld.cc:5747 (mysqld+0x6767d4)
          #9 main /test/10.4_opt_san/sql/main.cc:25 (mysqld+0x63a245)
       
      SUMMARY: ThreadSanitizer: data race /test/10.4_opt_san/storage/innobase/srv/srv0mon.cc:2190 in srv_mon_default_on()
      

      Which is MDEV-24329. But note the first frame:

          #0 os_file_pread /test/10.4_opt_san/storage/innobase/os/os0file.cc:4987 (mysqld+0x10e16bc)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kevg Eugene Kosov
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration