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

plugin loading error deadlock with server_audit enabled

    XMLWordPrintable

    Details

      Description

      When having the audit plugin installed with plugin-load-add, a failure to load a plugin that was installed with INSTALL; not plugin-load-add, leads to a server startup deadlock.

      Problem seems to be with the audit plugins error handling callback.

      I can't reproduce startup hang when having both plugins loaded with plugin-load-add, or both with INSTALL, only with the combination described above.

      gdb shows the following backtrace:

      #0  0x00007fa79a5474ed in __lll_lock_wait () from /lib64/libpthread.so.0
      #1  0x00007fa79a542e01 in _L_lock_1093 () from /lib64/libpthread.so.0
      #2  0x00007fa79a542da2 in pthread_mutex_lock () from /lib64/libpthread.so.0
      #3  0x0000556bb62a09e0 in inline_mysql_mutex_lock (src_line=src_line@entry=2405, 
          src_file=0x556bb6ac1f30 "/home/buildbot/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/mariadb-10.4.8/sql/sql_plugin.cc", 
          that=0x556bb7431f90 <LOCK_plugin>) at /usr/src/debug/MariaDB-10.4.8/src_0/include/mysql/psi/mysql_thread.h:712
      #4  0x0000556bb62a3c4d in plugin_foreach_with_mask (thd=thd@entry=0x556bb9eeeb88, func=func@entry=0x556bb63793f0 <acquire_plugins(THD*, plugin_ref, void*)>, 
          type=type@entry=5, state_mask=state_mask@entry=8, arg=arg@entry=0x7fff15818af0) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_plugin.cc:2405
      #5  0x0000556bb63794a2 in mysql_audit_acquire_plugins (thd=thd@entry=0x556bb9eeeb88, event_class_mask=event_class_mask@entry=0x7fff15818af0)
          at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_audit.cc:120
      #6  0x0000556bb63799d3 in mysql_audit_notify (thd=0x556bb9eeeb88, event_class=<optimized out>, event=<optimized out>)
          at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_audit.cc:433
      #7  0x0000556bb6243b77 in THD::raise_condition (this=this@entry=0x556bb9eeeb88, sql_errno=sql_errno@entry=1126, sqlstate=0x556bb6ac94b0 "HY000", 
          sqlstate@entry=0x0, level=Sql_state_errno_level::WARN_LEVEL_ERROR, ucid=..., 
          msg=msg@entry=0x7fff158190c0 "Can't open shared library '/usr/lib64/mysql/plugin/ha_blackhole.so' (errno: 0, cannot open shared object file: No such file or directory)") at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_audit.h:192
      #8  0x0000556bb61cb2bf in raise_condition (
          msg=0x7fff158190c0 "Can't open shared library '/usr/lib64/mysql/plugin/ha_blackhole.so' (errno: 0, cannot open shared object file: No such file or directory)", level=<optimized out>, sqlstate=0x0, sql_errno=1126, this=0x556bb9eeeb88) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_class.h:4356
      #9  my_message_sql (error=1126, 
          str=0x7fff158190c0 "Can't open shared library '/usr/lib64/mysql/plugin/ha_blackhole.so' (errno: 0, cannot open shared object file: No such file or directory)", MyFlags=64) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/mysqld.cc:3371
      #10 0x0000556bb6a000c0 in my_error (nr=1126, MyFlags=64) at /usr/src/debug/MariaDB-10.4.8/src_0/mysys/my_error.c:125
      #11 0x0000556bb62a1491 in plugin_dl_add (dl=dl@entry=0x7fff15819c80, MyFlags=MyFlags@entry=64) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_plugin.cc:797
      #12 0x0000556bb62a1c61 in plugin_add (tmp_root=tmp_root@entry=0x7fff1581a700, if_not_exists=if_not_exists@entry=false, name=name@entry=0x7fff15819c70, 
          dl=dl@entry=0x7fff15819c80, MyFlags=MyFlags@entry=64) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_plugin.cc:1101
      #13 0x0000556bb62a2828 in plugin_load (tmp_root=tmp_root@entry=0x7fff1581a700) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_plugin.cc:1859
      #14 0x0000556bb62a77b9 in plugin_init (argc=argc@entry=0x556bb742dc70 <remaining_argc>, argv=0x556bb95fa760, flags=0)
          at /usr/src/debug/MariaDB-10.4.8/src_0/sql/sql_plugin.cc:1735
      #15 0x0000556bb61cf9c8 in init_server_components () at /usr/src/debug/MariaDB-10.4.8/src_0/sql/mysqld.cc:5205
      #16 0x0000556bb61d5e91 in mysqld_main (argc=3, argv=0x556bb95fa760) at /usr/src/debug/MariaDB-10.4.8/src_0/sql/mysqld.cc:5726
      #17 0x00007fa7988083d5 in __libc_start_main () from /lib64/libc.so.6
      #18 0x0000556bb61c9bd4 in _start ()
      

      How to reproduce:

      • load server audit plugin from my.cnf with plugin-load-add
      • install another plugin, e.g. ha_blackhole, with INSTALL PLUGIN or INSTALL SONAME
      • stop the mariadb server
      • remove the ha_blackhole.so file from the plugin directory
      • restart mariadb server

      Server startup will now hang, startup will never finish

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serg Sergei Golubchik
              Reporter:
              hholzgra Hartmut Holzgraefe
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Due:
                Created:
                Updated: