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

DROP FUNCTION UDF doesn't unload shared library

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7.2
    • N/A
    • Documentation
    • None
    • Ubuntu 24.04, MariaDB 11.7.2

    Description

      I've created a shared library with some custom functions.

      I can load and use them, i.e.:

      CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib.so';
       
      SELECT my_func();
      -> 'version 1';
      

      However, when I DROP the function, recompile the library and move it to the plugin directory, and CREATE the UDF again, MariaDB still has the old version of the library in memory:

      DROP FUNCTION my_func();
      CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib.so';
       
      SELECT my_func();
      -> 'version 1';
      

      (but should return 'version 2')

      When I rename the library and create the function with the new name, it works:

      CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib2.so';
       
      SELECT my_func();
      -> 'version 2';
      

      According to the documentation, the correct sequence is:

      To upgrade the UDF's shared library, first run a DROP FUNCTION statement, then upgrade the shared library and finally
      run the CREATE FUNCTION statement. If you upgrade without following this process, you may crash the server.

      see:
      MariaDB KnowledgeBase

      Conclusion:

      MariaDB server doesn't unload the shared library, when there are no more functions that use it. Consequence is, that the server has to be restarted every time a new version of a shared library for UDFs is installed.

      So, either this is a bug, or the documentation should reflect this limitation.

      Attachments

        Activity

          People

            stefan.hinz Stefan Hinz
            louis77 Louis Brauer
            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.