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

TSAN: data race in aio_linux.cc during innodb_init (affects most TSAN testing)

Details

    Description

      This data race is seen on startup. It is blocking (likely very many) other TSAN issues from being analyzed.

      10.8.0 5566cbadb03856aba9c236b131f544490cd2bee4 (Debug, TSAN)

      WARNING: ThreadSanitizer: data race (pid=1951015)
        Read of size 8 at 0x7f4f6da38fa0 by thread T3:
          #0 tpool::aio_linux::getevent_thread_routine(tpool::aio_linux*) /test/10.8_dbg_san/tpool/aio_linux.cc:132 (mariadbd+0x1a50dcd)
          #1 void std::__invoke_impl<void, void (*)(tpool::aio_linux*), tpool::aio_linux*>(std::__invoke_other, void (*&&)(tpool::aio_linux*), tpool::aio_linux*&&) /usr/include/c++/9/bits/invoke.h:60 (mariadbd+0x1a50b8f)
          #2 std::__invoke_result<void (*)(tpool::aio_linux*), tpool::aio_linux*>::type std::__invoke<void (*)(tpool::aio_linux*), tpool::aio_linux*>(void (*&&)(tpool::aio_linux*), tpool::aio_linux*&&) /usr/include/c++/9/bits/invoke.h:95 (mariadbd+0x1a50b8f)
          #3 void std::thread::_Invoker<std::tuple<void (*)(tpool::aio_linux*), tpool::aio_linux*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/9/thread:244 (mariadbd+0x1a50b8f)
          #4 std::thread::_Invoker<std::tuple<void (*)(tpool::aio_linux*), tpool::aio_linux*> >::operator()() /usr/include/c++/9/thread:251 (mariadbd+0x1a50b8f)
          #5 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(tpool::aio_linux*), tpool::aio_linux*> > >::_M_run() /usr/include/c++/9/thread:195 (mariadbd+0x1a50b8f)
          #6 <null> <null> (libstdc++.so.6+0xd6de3)
       
        Previous write of size 8 at 0x7f4f6da38fa0 by thread T6:
          #0 os_aio(IORequest const&, void*, unsigned long, unsigned long) /test/10.8_dbg_san/storage/innobase/os/os0file.cc:3891 (mariadbd+0x160eb1e)
          #1 fil_space_t::io(IORequest const&, unsigned long, unsigned long, void*, buf_page_t*) /test/10.8_dbg_san/storage/innobase/fil/fil0fil.cc:2839 (mariadbd+0x19799c9)
          #2 buf_read_page_low /test/10.8_dbg_san/storage/innobase/buf/buf0rea.cc:333 (mariadbd+0x18e8e87)
          #3 buf_read_page_background(fil_space_t*, page_id_t, unsigned long) /test/10.8_dbg_san/storage/innobase/buf/buf0rea.cc:499 (mariadbd+0x18ea755)
          #4 buf_load /test/10.8_dbg_san/storage/innobase/buf/buf0dump.cc:686 (mariadbd+0x18c4dd0)
          #5 buf_dump_load_func /test/10.8_dbg_san/storage/innobase/buf/buf0dump.cc:771 (mariadbd+0x18c56f9)
          #6 tpool::task::execute() /test/10.8_dbg_san/tpool/task.cc:37 (mariadbd+0x1a5003f)
          #7 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.8_dbg_san/tpool/tpool_generic.cc:549 (mariadbd+0x1a4dbf2)
          #8 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+0x1a4e2a1)
          #9 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+0x1a4e2a1)
          #10 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+0x1a4e2a1)
          #11 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+0x1a4e2a1)
          #12 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+0x1a4e2a1)
          #13 <null> <null> (libstdc++.so.6+0xd6de3)
        Location is heap block of size 196608 at 0x7f4f6da09000 allocated by main thread:
          #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8c032)
          #1 tpool::cache<tpool::aiocb>::cache(unsigned long, tpool::cache_notification_mode) /usr/include/c++/9/ext/new_allocator.h:114 (mariadbd+0x160f18e)
          #2 io_slots::io_slots(int, int) /test/10.8_dbg_san/storage/innobase/os/os0file.cc:96 (mariadbd+0x160f18e)
          #3 os_aio_init() /test/10.8_dbg_san/storage/innobase/os/os0file.cc:3750 (mariadbd+0x160f18e)
          #4 srv_start(bool) /test/10.8_dbg_san/storage/innobase/srv/srv0start.cc:1191 (mariadbd+0x179a992)
          #5 innodb_init /test/10.8_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc555)
          #6 ha_initialize_handlerton(st_plugin_int*) /test/10.8_dbg_san/sql/handler.cc:649 (mariadbd+0xe312be)
          #7 plugin_initialize /test/10.8_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec57)
          #8 plugin_init(int*, char**, int) /test/10.8_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902556)
          #9 init_server_components /test/10.8_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
          #10 mysqld_main(int, char**) /test/10.8_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
          #11 main /test/10.8_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
       
        Thread T3 (tid=1952469, running) created by main thread at:
          #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd70a8)
          #2 tpool::thread_pool_generic::create_native_aio(int) /test/10.8_dbg_san/tpool/tpool_generic.cc:285 (mariadbd+0x1a4e37e)
          #3 tpool::thread_pool::configure_aio(bool, int) /test/10.8_dbg_san/tpool/tpool.h:215 (mariadbd+0x16103fb)
          #4 os_aio_init() /test/10.8_dbg_san/storage/innobase/os/os0file.cc:3759 (mariadbd+0x16103fb)
          #5 srv_start(bool) /test/10.8_dbg_san/storage/innobase/srv/srv0start.cc:1191 (mariadbd+0x179a992)
          #6 innodb_init /test/10.8_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc555)
          #7 ha_initialize_handlerton(st_plugin_int*) /test/10.8_dbg_san/sql/handler.cc:649 (mariadbd+0xe312be)
          #8 plugin_initialize /test/10.8_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec57)
          #9 plugin_init(int*, char**, int) /test/10.8_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902556)
          #10 init_server_components /test/10.8_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
          #11 mysqld_main(int, char**) /test/10.8_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
          #12 main /test/10.8_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
       
        Thread T6 (tid=1953658, running) created by main thread at:
          #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
          #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd70a8)
          #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.8_dbg_san/tpool/tpool_generic.cc:806 (mariadbd+0x1a4ce90)
          #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.8_dbg_san/tpool/tpool_generic.cc:825 (mariadbd+0x1a4de3a)
          #4 buf_do_load_dump /test/10.8_dbg_san/storage/innobase/buf/buf0dump.cc:825 (mariadbd+0x18c30c1)
          #5 buf_load_at_startup() /test/10.8_dbg_san/storage/innobase/buf/buf0dump.cc:819 (mariadbd+0x18c31f4)
          #6 srv_start(bool) /test/10.8_dbg_san/storage/innobase/srv/srv0start.cc:1876 (mariadbd+0x179e639)
          #7 innodb_init /test/10.8_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc555)
          #8 ha_initialize_handlerton(st_plugin_int*) /test/10.8_dbg_san/sql/handler.cc:649 (mariadbd+0xe312be)
          #9 plugin_initialize /test/10.8_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec57)
          #10 plugin_init(int*, char**, int) /test/10.8_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902556)
          #11 init_server_components /test/10.8_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
          #12 mysqld_main(int, char**) /test/10.8_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
          #13 main /test/10.8_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
       
      SUMMARY: ThreadSanitizer: data race /test/10.8_dbg_san/tpool/aio_linux.cc:132 in tpool::aio_linux::getevent_thread_routine(tpool::aio_linux*)
      

      Attachments

        Activity

          10.2 Does not show the issue. 10.3 and 10.4 produce a different stack, but it looks related:

          10.4.23 d270525dfde86bcb92a2327234a0954083e14a94 (Debug, TSAN)

          WARNING: ThreadSanitizer: data race (pid=1950501)
            Read of size 8 at 0x7bbc0000e080 by thread T4:
              #0 LinuxAIOHandler::collect() /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1834 (mysqld+0x147d45c)
              #1 LinuxAIOHandler::poll(fil_node_t**, void**, IORequest*) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1984 (mysqld+0x14857a5)
              #2 os_aio_linux_handler /test/10.4_dbg_san/storage/innobase/os/os0file.cc:2038 (mysqld+0x1485a4e)
              #3 os_aio_handler(unsigned long, fil_node_t**, void**, IORequest*) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5366 (mysqld+0x1485a4e)
              #4 fil_aio_wait(unsigned long) /test/10.4_dbg_san/storage/innobase/fil/fil0fil.cc:4315 (mysqld+0x182f99d)
              #5 io_handler_thread /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:324 (mysqld+0x161221e)
           
            Previous write of size 8 at 0x7bbc0000e080 by main thread (mutexes: write M1111357981243299920, write M1575):
              #0 AIO::reserve_slot(IORequest const&, fil_node_t*, void*, pfs_os_file_t, char const*, void*, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:6004 (mysqld+0x1482c5d)
              #1 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_dbg_san/storage/innobase/os/os0file.cc:6369 (mysqld+0x1484974)
              #2 pfs_os_aio_func /test/10.4_dbg_san/storage/innobase/include/os0file.ic:253 (mysqld+0x1836402)
              #3 fil_io(IORequest const&, bool, page_id_t, unsigned long, unsigned long, unsigned long, void*, void*, bool) /test/10.4_dbg_san/storage/innobase/fil/fil0fil.cc:4270 (mysqld+0x1836402)
              #4 log_group_checkpoint /test/10.4_dbg_san/storage/innobase/log/log0log.cc:1347 (mysqld+0x143100d)
              #5 log_write_checkpoint_info(bool, unsigned long) /test/10.4_dbg_san/storage/innobase/log/log0log.cc:1382 (mysqld+0x143100d)
              #6 recv_synchronize_groups /test/10.4_dbg_san/storage/innobase/log/log0recv.cc:1044 (mysqld+0x1452358)
              #7 recv_recovery_from_checkpoint_start(unsigned long) /test/10.4_dbg_san/storage/innobase/log/log0recv.cc:3843 (mysqld+0x1452358)
              #8 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1875 (mysqld+0x1618eb7)
              #9 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f)
              #10 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4)
              #11 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c)
              #12 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be)
              #13 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa)
              #14 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1)
              #15 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)
           
            Location is heap block of size 57344 at 0x7bbc0000e000 allocated by main thread:
              #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8c032)
              #1 __gnu_cxx::new_allocator<Slot>::allocate(unsigned long, void const*) /usr/include/c++/9/ext/new_allocator.h:114 (mysqld+0x1479b16)
              #2 std::allocator_traits<std::allocator<Slot> >::allocate(std::allocator<Slot>&, unsigned long) /usr/include/c++/9/bits/alloc_traits.h:444 (mysqld+0x1479b16)
              #3 std::_Vector_base<Slot, std::allocator<Slot> >::_M_allocate(unsigned long) /usr/include/c++/9/bits/stl_vector.h:343 (mysqld+0x1479b16)
              #4 std::_Vector_base<Slot, std::allocator<Slot> >::_M_create_storage(unsigned long) /usr/include/c++/9/bits/stl_vector.h:358 (mysqld+0x1479b16)
              #5 std::_Vector_base<Slot, std::allocator<Slot> >::_Vector_base(unsigned long, std::allocator<Slot> const&) /usr/include/c++/9/bits/stl_vector.h:302 (mysqld+0x1479b16)
              #6 std::vector<Slot, std::allocator<Slot> >::vector(unsigned long, std::allocator<Slot> const&) /usr/include/c++/9/bits/stl_vector.h:508 (mysqld+0x1479b16)
              #7 AIO::AIO(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5406 (mysqld+0x1479b16)
              #8 AIO::create(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5549 (mysqld+0x148331e)
              #9 AIO::start(unsigned long, unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5643 (mysqld+0x1483665)
              #10 os_aio_init(unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5750 (mysqld+0x14839ad)
              #11 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1481 (mysqld+0x16174b2)
              #12 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f)
              #13 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4)
              #14 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c)
              #15 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be)
              #16 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa)
              #17 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1)
              #18 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)
           
            Mutex M1111357981243299920 is already destroyed.
           
            Mutex M1575 (0x7b4400000b50) created at:
              #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616)
              #1 OSMutex::init() /test/10.4_dbg_san/storage/innobase/include/sync0types.h:388 (mysqld+0x14006f2)
              #2 OSTrackMutex<GenericPolicy>::init(latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ib0mutex.h:61 (mysqld+0x14006f2)
              #3 PolicyMutex<OSTrackMutex<GenericPolicy> >::init(latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ib0mutex.h:661 (mysqld+0x14006f2)
              #4 void mutex_init<PolicyMutex<OSTrackMutex<GenericPolicy> > >(PolicyMutex<OSTrackMutex<GenericPolicy> >*, latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ut0mutex.h:176 (mysqld+0x14006f2)
              #5 AIO::AIO(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5415 (mysqld+0x1479e17)
              #6 AIO::create(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5549 (mysqld+0x148331e)
              #7 AIO::start(unsigned long, unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5643 (mysqld+0x1483665)
              #8 os_aio_init(unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5750 (mysqld+0x14839ad)
              #9 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1481 (mysqld+0x16174b2)
              #10 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f)
              #11 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4)
              #12 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c)
              #13 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be)
              #14 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa)
              #15 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1)
              #16 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)
           
            Thread T4 (tid=1957430, running) created by main thread at:
              #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
              #1 os_thread_create_func(void* (*)(void*), void*, unsigned long*) /test/10.4_dbg_san/storage/innobase/os/os0thread.cc:138 (mysqld+0x14882cb)
              #2 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1551 (mysqld+0x1617a52)
              #3 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f)
              #4 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4)
              #5 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c)
              #6 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be)
              #7 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa)
              #8 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1)
              #9 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)
           
          SUMMARY: ThreadSanitizer: data race /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1834 in LinuxAIOHandler::collect()
          

          Roel Roel Van de Paar added a comment - 10.2 Does not show the issue. 10.3 and 10.4 produce a different stack, but it looks related: 10.4.23 d270525dfde86bcb92a2327234a0954083e14a94 (Debug, TSAN) WARNING: ThreadSanitizer: data race (pid=1950501) Read of size 8 at 0x7bbc0000e080 by thread T4: #0 LinuxAIOHandler::collect() /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1834 (mysqld+0x147d45c) #1 LinuxAIOHandler::poll(fil_node_t**, void**, IORequest*) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1984 (mysqld+0x14857a5) #2 os_aio_linux_handler /test/10.4_dbg_san/storage/innobase/os/os0file.cc:2038 (mysqld+0x1485a4e) #3 os_aio_handler(unsigned long, fil_node_t**, void**, IORequest*) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5366 (mysqld+0x1485a4e) #4 fil_aio_wait(unsigned long) /test/10.4_dbg_san/storage/innobase/fil/fil0fil.cc:4315 (mysqld+0x182f99d) #5 io_handler_thread /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:324 (mysqld+0x161221e)   Previous write of size 8 at 0x7bbc0000e080 by main thread (mutexes: write M1111357981243299920, write M1575): #0 AIO::reserve_slot(IORequest const&, fil_node_t*, void*, pfs_os_file_t, char const*, void*, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:6004 (mysqld+0x1482c5d) #1 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_dbg_san/storage/innobase/os/os0file.cc:6369 (mysqld+0x1484974) #2 pfs_os_aio_func /test/10.4_dbg_san/storage/innobase/include/os0file.ic:253 (mysqld+0x1836402) #3 fil_io(IORequest const&, bool, page_id_t, unsigned long, unsigned long, unsigned long, void*, void*, bool) /test/10.4_dbg_san/storage/innobase/fil/fil0fil.cc:4270 (mysqld+0x1836402) #4 log_group_checkpoint /test/10.4_dbg_san/storage/innobase/log/log0log.cc:1347 (mysqld+0x143100d) #5 log_write_checkpoint_info(bool, unsigned long) /test/10.4_dbg_san/storage/innobase/log/log0log.cc:1382 (mysqld+0x143100d) #6 recv_synchronize_groups /test/10.4_dbg_san/storage/innobase/log/log0recv.cc:1044 (mysqld+0x1452358) #7 recv_recovery_from_checkpoint_start(unsigned long) /test/10.4_dbg_san/storage/innobase/log/log0recv.cc:3843 (mysqld+0x1452358) #8 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1875 (mysqld+0x1618eb7) #9 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f) #10 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4) #11 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c) #12 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be) #13 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa) #14 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1) #15 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)   Location is heap block of size 57344 at 0x7bbc0000e000 allocated by main thread: #0 operator new(unsigned long) ../../../../src/libsanitizer/tsan/tsan_new_delete.cpp:64 (libtsan.so.0+0x8c032) #1 __gnu_cxx::new_allocator<Slot>::allocate(unsigned long, void const*) /usr/include/c++/9/ext/new_allocator.h:114 (mysqld+0x1479b16) #2 std::allocator_traits<std::allocator<Slot> >::allocate(std::allocator<Slot>&, unsigned long) /usr/include/c++/9/bits/alloc_traits.h:444 (mysqld+0x1479b16) #3 std::_Vector_base<Slot, std::allocator<Slot> >::_M_allocate(unsigned long) /usr/include/c++/9/bits/stl_vector.h:343 (mysqld+0x1479b16) #4 std::_Vector_base<Slot, std::allocator<Slot> >::_M_create_storage(unsigned long) /usr/include/c++/9/bits/stl_vector.h:358 (mysqld+0x1479b16) #5 std::_Vector_base<Slot, std::allocator<Slot> >::_Vector_base(unsigned long, std::allocator<Slot> const&) /usr/include/c++/9/bits/stl_vector.h:302 (mysqld+0x1479b16) #6 std::vector<Slot, std::allocator<Slot> >::vector(unsigned long, std::allocator<Slot> const&) /usr/include/c++/9/bits/stl_vector.h:508 (mysqld+0x1479b16) #7 AIO::AIO(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5406 (mysqld+0x1479b16) #8 AIO::create(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5549 (mysqld+0x148331e) #9 AIO::start(unsigned long, unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5643 (mysqld+0x1483665) #10 os_aio_init(unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5750 (mysqld+0x14839ad) #11 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1481 (mysqld+0x16174b2) #12 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f) #13 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4) #14 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c) #15 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be) #16 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa) #17 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1) #18 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)   Mutex M1111357981243299920 is already destroyed.   Mutex M1575 (0x7b4400000b50) created at: #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616) #1 OSMutex::init() /test/10.4_dbg_san/storage/innobase/include/sync0types.h:388 (mysqld+0x14006f2) #2 OSTrackMutex<GenericPolicy>::init(latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ib0mutex.h:61 (mysqld+0x14006f2) #3 PolicyMutex<OSTrackMutex<GenericPolicy> >::init(latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ib0mutex.h:661 (mysqld+0x14006f2) #4 void mutex_init<PolicyMutex<OSTrackMutex<GenericPolicy> > >(PolicyMutex<OSTrackMutex<GenericPolicy> >*, latch_id_t, char const*, unsigned int) /test/10.4_dbg_san/storage/innobase/include/ut0mutex.h:176 (mysqld+0x14006f2) #5 AIO::AIO(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5415 (mysqld+0x1479e17) #6 AIO::create(latch_id_t, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5549 (mysqld+0x148331e) #7 AIO::start(unsigned long, unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5643 (mysqld+0x1483665) #8 os_aio_init(unsigned long, unsigned long, unsigned long) /test/10.4_dbg_san/storage/innobase/os/os0file.cc:5750 (mysqld+0x14839ad) #9 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1481 (mysqld+0x16174b2) #10 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f) #11 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4) #12 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c) #13 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be) #14 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa) #15 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1) #16 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)   Thread T4 (tid=1957430, running) created by main thread at: #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79) #1 os_thread_create_func(void* (*)(void*), void*, unsigned long*) /test/10.4_dbg_san/storage/innobase/os/os0thread.cc:138 (mysqld+0x14882cb) #2 srv_start(bool) /test/10.4_dbg_san/storage/innobase/srv/srv0start.cc:1551 (mysqld+0x1617a52) #3 innodb_init /test/10.4_dbg_san/storage/innobase/handler/ha_innodb.cc:4320 (mysqld+0x1340b5f) #4 ha_initialize_handlerton(st_plugin_int*) /test/10.4_dbg_san/sql/handler.cc:574 (mysqld+0xc9ecd4) #5 plugin_initialize /test/10.4_dbg_san/sql/sql_plugin.cc:1438 (mysqld+0x7d3d8c) #6 plugin_init(int*, char**, int) /test/10.4_dbg_san/sql/sql_plugin.cc:1720 (mysqld+0x7d66be) #7 init_server_components /test/10.4_dbg_san/sql/mysqld.cc:5189 (mysqld+0x5cd2aa) #8 mysqld_main(int, char**) /test/10.4_dbg_san/sql/mysqld.cc:5726 (mysqld+0x5d7ef1) #9 main /test/10.4_dbg_san/sql/main.cc:25 (mysqld+0x5c0d2b)   SUMMARY: ThreadSanitizer: data race /test/10.4_dbg_san/storage/innobase/os/os0file.cc:1834 in LinuxAIOHandler::collect()

          This should not be a real data race, but the result of missing wrappers for the io_submit() and io_getevents() system calls in ThreadSanitizer.

          I do not think that this interface is any different between 10.2 and 10.3. Starting with MDEV-24883 in 10.6, we also support io_uring. Does that generate ThreadSanitizer error messages?

          marko Marko Mäkelä added a comment - This should not be a real data race, but the result of missing wrappers for the io_submit() and io_getevents() system calls in ThreadSanitizer. I do not think that this interface is any different between 10.2 and 10.3. Starting with MDEV-24883 in 10.6, we also support io_uring . Does that generate ThreadSanitizer error messages?

          Using --skip_innodb_use_native_aio avoids the given stack, but shows this one (possibly a different issue):

          10.7.2 d9a5c5db072e58cc21d462d107f9e018329011a4 (Debug, TSAN)

          WARNING: ThreadSanitizer: data race (pid=2756542)
            Read of size 4 at 0x559a9a41b024 by thread T4:
              #0 buf_pool_t::page_hash_table::get(page_id_t, buf_pool_t::hash_chain const&) const /test/10.7_dbg_san/storage/innobase/include/buf0buf.h:1989 (mariadbd+0x18af4e5)
              #1 buf_page_get_low(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, mtr_t*, dberr_t*, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:2566 (mariadbd+0x18af4e5)
              #2 buf_page_get_gen(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, mtr_t*, dberr_t*, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:3033 (mariadbd+0x18b1639)
              #3 ibuf_bitmap_get_map_page /test/10.7_dbg_san/storage/innobase/ibuf/ibuf0ibuf.cc:669 (mariadbd+0x1576b0d)
              #4 ibuf_page_low(page_id_t, unsigned long, bool, mtr_t*) /test/10.7_dbg_san/storage/innobase/ibuf/ibuf0ibuf.cc:972 (mariadbd+0x1581da2)
              #5 buf_read_page_low /test/10.7_dbg_san/storage/innobase/buf/buf0rea.cc:288 (mariadbd+0x18e8cb4)
              #6 buf_read_page_background(fil_space_t*, page_id_t, unsigned long) /test/10.7_dbg_san/storage/innobase/buf/buf0rea.cc:499 (mariadbd+0x18ea74f)
              #7 buf_load /test/10.7_dbg_san/storage/innobase/buf/buf0dump.cc:686 (mariadbd+0x18c4dca)
              #8 buf_dump_load_func /test/10.7_dbg_san/storage/innobase/buf/buf0dump.cc:771 (mariadbd+0x18c56f3)
              #9 tpool::task::execute() /test/10.7_dbg_san/tpool/task.cc:37 (mariadbd+0x1a50039)
              #10 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.7_dbg_san/tpool/tpool_generic.cc:549 (mariadbd+0x1a4dbec)
              #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+0x1a4e29b)
              #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+0x1a4e29b)
              #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+0x1a4e29b)
              #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+0x1a4e29b)
              #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+0x1a4e29b)
              #16 <null> <null> (libstdc++.so.6+0xd6de3)
           
            Previous write of size 4 at 0x559a9a41b024 by main thread (mutexes: write M1601, write M1600):
              #0 safe_mutex_unlock /test/10.7_dbg_san/mysys/thr_mutex.c:434 (mariadbd+0x1b17674)
              #1 inline_mysql_mutex_unlock /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:790 (mariadbd+0x18da063)
              #2 buf_LRU_old_ratio_update(unsigned int, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0lru.cc:1314 (mariadbd+0x18da063)
              #3 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4216 (mariadbd+0x14dc608)
              #4 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8)
              #5 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51)
              #6 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550)
              #7 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
              #8 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
              #9 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
           
            Location is global 'buf_pool' of size 22144 at 0x559a9a41afc0 (mariadbd+0x0000026f2024)
           
            Mutex M1601 (0x559a9a41afe8) created at:
              #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616)
              #1 safe_mutex_init /test/10.7_dbg_san/mysys/thr_mutex.c:189 (mariadbd+0x1b167a8)
              #2 inline_mysql_mutex_init /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:703 (mariadbd+0x18ad06a)
              #3 buf_pool_t::create() /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:1212 (mariadbd+0x18ad06a)
              #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1214 (mariadbd+0x179ab3c)
              #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f)
              #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8)
              #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51)
              #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550)
              #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
              #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
              #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
           
            Mutex M1600 (0x559a9a41afc0) created at:
              #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616)
              #1 safe_mutex_init /test/10.7_dbg_san/mysys/thr_mutex.c:188 (mariadbd+0x1b1679c)
              #2 inline_mysql_mutex_init /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:703 (mariadbd+0x18ad06a)
              #3 buf_pool_t::create() /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:1212 (mariadbd+0x18ad06a)
              #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1214 (mariadbd+0x179ab3c)
              #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f)
              #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8)
              #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51)
              #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550)
              #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
              #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
              #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
           
            Thread T4 (tid=2756755, running) created by main thread at:
              #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79)
              #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd70a8)
              #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.7_dbg_san/tpool/tpool_generic.cc:806 (mariadbd+0x1a4ce8a)
              #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.7_dbg_san/tpool/tpool_generic.cc:825 (mariadbd+0x1a4de34)
              #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1788 (mariadbd+0x179dd70)
              #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f)
              #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8)
              #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51)
              #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550)
              #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370)
              #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962)
              #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)
           
          SUMMARY: ThreadSanitizer: data race /test/10.7_dbg_san/storage/innobase/include/buf0buf.h:1989 in buf_pool_t::page_hash_table::get(page_id_t, buf_pool_t::hash_chain const&) const
          

          Roel Roel Van de Paar added a comment - Using --skip_innodb_use_native_aio avoids the given stack, but shows this one (possibly a different issue): 10.7.2 d9a5c5db072e58cc21d462d107f9e018329011a4 (Debug, TSAN) WARNING: ThreadSanitizer: data race (pid=2756542) Read of size 4 at 0x559a9a41b024 by thread T4: #0 buf_pool_t::page_hash_table::get(page_id_t, buf_pool_t::hash_chain const&) const /test/10.7_dbg_san/storage/innobase/include/buf0buf.h:1989 (mariadbd+0x18af4e5) #1 buf_page_get_low(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, mtr_t*, dberr_t*, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:2566 (mariadbd+0x18af4e5) #2 buf_page_get_gen(page_id_t, unsigned long, unsigned long, buf_block_t*, unsigned long, mtr_t*, dberr_t*, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:3033 (mariadbd+0x18b1639) #3 ibuf_bitmap_get_map_page /test/10.7_dbg_san/storage/innobase/ibuf/ibuf0ibuf.cc:669 (mariadbd+0x1576b0d) #4 ibuf_page_low(page_id_t, unsigned long, bool, mtr_t*) /test/10.7_dbg_san/storage/innobase/ibuf/ibuf0ibuf.cc:972 (mariadbd+0x1581da2) #5 buf_read_page_low /test/10.7_dbg_san/storage/innobase/buf/buf0rea.cc:288 (mariadbd+0x18e8cb4) #6 buf_read_page_background(fil_space_t*, page_id_t, unsigned long) /test/10.7_dbg_san/storage/innobase/buf/buf0rea.cc:499 (mariadbd+0x18ea74f) #7 buf_load /test/10.7_dbg_san/storage/innobase/buf/buf0dump.cc:686 (mariadbd+0x18c4dca) #8 buf_dump_load_func /test/10.7_dbg_san/storage/innobase/buf/buf0dump.cc:771 (mariadbd+0x18c56f3) #9 tpool::task::execute() /test/10.7_dbg_san/tpool/task.cc:37 (mariadbd+0x1a50039) #10 tpool::thread_pool_generic::worker_main(tpool::worker_data*) /test/10.7_dbg_san/tpool/tpool_generic.cc:549 (mariadbd+0x1a4dbec) #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+0x1a4e29b) #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+0x1a4e29b) #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+0x1a4e29b) #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+0x1a4e29b) #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+0x1a4e29b) #16 <null> <null> (libstdc++.so.6+0xd6de3)   Previous write of size 4 at 0x559a9a41b024 by main thread (mutexes: write M1601, write M1600): #0 safe_mutex_unlock /test/10.7_dbg_san/mysys/thr_mutex.c:434 (mariadbd+0x1b17674) #1 inline_mysql_mutex_unlock /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:790 (mariadbd+0x18da063) #2 buf_LRU_old_ratio_update(unsigned int, bool) /test/10.7_dbg_san/storage/innobase/buf/buf0lru.cc:1314 (mariadbd+0x18da063) #3 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4216 (mariadbd+0x14dc608) #4 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8) #5 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51) #6 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550) #7 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370) #8 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962) #9 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)   Location is global 'buf_pool' of size 22144 at 0x559a9a41afc0 (mariadbd+0x0000026f2024)   Mutex M1601 (0x559a9a41afe8) created at: #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616) #1 safe_mutex_init /test/10.7_dbg_san/mysys/thr_mutex.c:189 (mariadbd+0x1b167a8) #2 inline_mysql_mutex_init /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:703 (mariadbd+0x18ad06a) #3 buf_pool_t::create() /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:1212 (mariadbd+0x18ad06a) #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1214 (mariadbd+0x179ab3c) #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f) #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8) #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51) #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550) #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370) #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962) #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)   Mutex M1600 (0x559a9a41afc0) created at: #0 pthread_mutex_init ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:1220 (libtsan.so.0+0x4a616) #1 safe_mutex_init /test/10.7_dbg_san/mysys/thr_mutex.c:188 (mariadbd+0x1b1679c) #2 inline_mysql_mutex_init /test/10.7_dbg_san/include/mysql/psi/mysql_thread.h:703 (mariadbd+0x18ad06a) #3 buf_pool_t::create() /test/10.7_dbg_san/storage/innobase/buf/buf0buf.cc:1212 (mariadbd+0x18ad06a) #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1214 (mariadbd+0x179ab3c) #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f) #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8) #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51) #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550) #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370) #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962) #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)   Thread T4 (tid=2756755, running) created by main thread at: #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:962 (libtsan.so.0+0x5ea79) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xd70a8) #2 tpool::thread_pool_generic::maybe_wake_or_create_thread() /test/10.7_dbg_san/tpool/tpool_generic.cc:806 (mariadbd+0x1a4ce8a) #3 tpool::thread_pool_generic::submit_task(tpool::task*) /test/10.7_dbg_san/tpool/tpool_generic.cc:825 (mariadbd+0x1a4de34) #4 srv_start(bool) /test/10.7_dbg_san/storage/innobase/srv/srv0start.cc:1788 (mariadbd+0x179dd70) #5 innodb_init /test/10.7_dbg_san/storage/innobase/handler/ha_innodb.cc:4206 (mariadbd+0x14dc54f) #6 ha_initialize_handlerton(st_plugin_int*) /test/10.7_dbg_san/sql/handler.cc:649 (mariadbd+0xe312b8) #7 plugin_initialize /test/10.7_dbg_san/sql/sql_plugin.cc:1462 (mariadbd+0x8fec51) #8 plugin_init(int*, char**, int) /test/10.7_dbg_san/sql/sql_plugin.cc:1755 (mariadbd+0x902550) #9 init_server_components /test/10.7_dbg_san/sql/mysqld.cc:5080 (mariadbd+0x673370) #10 mysqld_main(int, char**) /test/10.7_dbg_san/sql/mysqld.cc:5695 (mariadbd+0x67d962) #11 main /test/10.7_dbg_san/sql/main.cc:34 (mariadbd+0x668dcb)   SUMMARY: ThreadSanitizer: data race /test/10.7_dbg_san/storage/innobase/include/buf0buf.h:1989 in buf_pool_t::page_hash_table::get(page_id_t, buf_pool_t::hash_chain const&) const

          We would seem to require some ThreadSanitizer instrumentation for the page_hash_latch and other synchronization primitives that are based on std::atomic. The lack of a data race here is enforced by a debug assertion:

          inline buf_page_t *buf_pool_t::page_hash_table::get(const page_id_t id,
                                                              const hash_chain &chain)
            const
          {
          #ifdef SAFE_MUTEX
            DBUG_ASSERT(mysql_mutex_is_owner(&buf_pool.mutex) ||
                        lock_get(const_cast<hash_chain&>(chain)).is_locked());
          #endif /* SAFE_MUTEX */
          

          Based on the output, ThreadSanitizer knows about buf_pool.mutex, but it does not appear to recognize the page_hash_latch.

          marko Marko Mäkelä added a comment - We would seem to require some ThreadSanitizer instrumentation for the page_hash_latch and other synchronization primitives that are based on std::atomic . The lack of a data race here is enforced by a debug assertion: inline buf_page_t *buf_pool_t::page_hash_table::get( const page_id_t id, const hash_chain &chain) const { #ifdef SAFE_MUTEX DBUG_ASSERT(mysql_mutex_is_owner(&buf_pool.mutex) || lock_get( const_cast <hash_chain&>(chain)).is_locked()); #endif /* SAFE_MUTEX */ Based on the output, ThreadSanitizer knows about buf_pool.mutex , but it does not appear to recognize the page_hash_latch .
          Roel Roel Van de Paar added a comment - - edited

          After compiling & installing https://github.com/axboe/liburing and using cmake -DWITH_URING=ON (and not using --skip_innodb_use_native_aio), the same result as using --skip_innodb_use_native_aio happens without io_uring.

          Roel Roel Van de Paar added a comment - - edited After compiling & installing https://github.com/axboe/liburing and using cmake -DWITH_URING=ON (and not using --skip_innodb_use_native_aio ), the same result as using --skip_innodb_use_native_aio happens without io_uring .

          People

            marko Marko Mäkelä
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.