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

Runtime plugin/UDF load errors are silently lost when server runs with --silent-startup

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.8.7
    • 11.8
    • Plugins, Tests, MTR
    • None
    • Q3/2026 Server Development, Q4/2026 Server Maintenance

    Description

      A server started with --silent-startup silently swallows plugin/UDF load errors at runtime. Operations such as INSTALL PLUGIN and CREATE FUNCTION ... SONAME that fail to open a library return success instead of raising ER_CANT_OPEN_LIBRARY (1126): no error reaches the client and the statement wrongly succeeds.

      Reproduce

      Run the main.ps test with the server started with --silent-startup:

      cd mysql-test
      ./mtr main.ps --mysqld=--silent-startup
      

      More generally, with any server run with --silent-startup, run a statement that loads a non-existent library, e.g. CREATE FUNCTION myfunc RETURNS INTEGER SONAME 'no_such.so'.

      Result

      Expected: fails with ER_CANT_OPEN_LIBRARY (1126).

      Actual: succeeds, no error raised. In main.ps:

      mysqltest: At line 2605: query 'call proc_1()' succeeded - should have failed with error ER_CANT_OPEN_LIBRARY (1126)
      

      Without --silent-startup (the stock MTR baseline) the test passes, which is why this is not caught in normal CI.

      Root cause

      Regression from commit 7828fb475b0 (MDEV-32745), which guarded the plugin-load my_error() calls in sql/sql_plugin.cc with opt_silent_startup:

      if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
      {
        if (!opt_silent_startup)
          my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dlpath, errno, my_dlerror(dlpath));
        goto ret;
      }
      

      opt_silent_startup is a lifetime global — set once from the command line and never reset after startup completes. So the guard suppresses the error for the whole server lifetime, not just during startup. Skipping my_error() means the diagnostics area is never set, so the runtime statement reports no error. The option is meant to silence only the startup error log (help text: "Don't print [Note] or failed plugin_loads during startup"), never runtime SQL errors.

      Fix

      Startup callers pass MYF(ME_ERROR_LOG) (errors go to the error log); runtime callers (e.g. mysql_install_plugin) pass MYF(0) (errors go to the client). The fix keys the silencing off that flag instead of the lifetime global:

      /* Silence plugin-load errors only on the startup error-log path, never at runtime. */
      static inline bool silent_plugin_startup(myf MyFlags)
      {
        return opt_silent_startup && (MyFlags & ME_ERROR_LOG);
      }
      

      All plugin-load my_error() guards in sql/sql_plugin.cc use !silent_plugin_startup(MyFlags) instead of !opt_silent_startup.

      Affects

      • Introduced by: 7828fb475b0 (MDEV-32745)
      • Any server run with --silent-startup: runtime INSTALL PLUGIN / CREATE FUNCTION ... SONAME failures are silently ignored.
      • Still present in mariadb/main; not addressed by the followup 04e09010773.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              midenok Aleksey Midenkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h 28m Original Estimate - 1h 28m
                  1h 28m
                  Remaining:
                  Time Spent - 1h Remaining Estimate - 1h 28m
                  1h 28m
                  Logged:
                  Time Spent - 1h Remaining Estimate - 1h 28m
                  1h

                  Git Integration

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