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

mariadb-backup immediately dumps core

Details

    Description

      When I run mariadb-backup, it immediately dumps core:

      # mariadb-backup
      Memory fault (core dumped)
      

      If I run it from the directory where it's installed (/usr/pkg/bin), it prints its help successfully:

      # cd /usr/pkg/bin
      # mariadb-backup
      mariadb-backup based on MariaDB server 10.11.8-MariaDB NetBSD (x86_64)
      Open source backup tool for InnoDB and XtraDB
       
      Copyright (C) 2009-2015 Percona LLC and/or its affiliates.
      Portions Copyright (C) 2000, 2011, MySQL AB & Innobase Oy.
      Portions Copyright (C) 2017-2023 MariaDB Corporation / MariaDB Plc.
      

      Attachments

        Issue Links

          Activity

            Can you provide some information from the core dump? In https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ you can find some advice. You would have to replace mariadbd with mariadbd-backup when reading that.

            Maybe you can just prepend gdb -ex run --args to your invocation of mariadb-backup? Then the crash should occur inside the debugger.

            marko Marko Mäkelä added a comment - Can you provide some information from the core dump? In https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ you can find some advice. You would have to replace mariadbd with mariadbd-backup when reading that. Maybe you can just prepend gdb -ex run --args to your invocation of mariadb-backup ? Then the crash should occur inside the debugger.

            A backtrace of the core dump file is quite short:

            {{(gdb) bt
            #0 0x000000012af2d064 in my_realpath ()
            #1 0x000000012b013332 in main ()}}

            wiz Thomas Klausner added a comment - A backtrace of the core dump file is quite short: {{(gdb) bt #0 0x000000012af2d064 in my_realpath () #1 0x000000012b013332 in main ()}}

            Thanks. It must be caused by MDEV-29582 then.

            serg Sergei Golubchik added a comment - Thanks. It must be caused by MDEV-29582 then.
            danblack Daniel Black added a comment -

            MDEV-13466 adds the call in mariabackup to my_realpath via get_exepath.

            wiz, feel like contributing a fix on extra/mariabackup/xtrabackup.cc:get_exepath on 10.5 for NetBSD and maybe other missing OSes - (ref: https://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe)

            danblack Daniel Black added a comment - MDEV-13466 adds the call in mariabackup to my_realpath via get_exepath. wiz , feel like contributing a fix on extra/mariabackup/xtrabackup.cc:get_exepath on 10.5 for NetBSD and maybe other missing OSes - (ref: https://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe )

            danblack, please, create a reusable function for this in mysys, so that MDEV-29582 could use it too

            serg Sergei Golubchik added a comment - danblack , please, create a reusable function for this in mysys, so that MDEV-29582 could use it too

            Thank you for the pointer, Daniel Black!
            The following diff against 10.11.9 adds support for this, and with it, mariadb-backup does not dump core on startup any longer:

            --- extra/mariabackup/xtrabackup.cc.orig        2024-08-03 07:29:56.000000000 +0000
            +++ extra/mariabackup/xtrabackup.cc
            @@ -69,6 +69,11 @@ Street, Fifth Floor, Boston, MA 02110-13
             # include <sys/sysctl.h>
             #endif
             
            +#ifdef __NetBSD__
            +# include <sys/param.h>
            +# include <sys/sysctl.h>
            +#endif
            +
             #include "aria_backup_client.h"
             
             #include <btr0sea.h>
            @@ -7690,6 +7695,11 @@ static int get_exepath(char *buf, size_t
               if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) {
                 return 0;
               }
            +#elif defined(__NetBSD__)
            +  int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME };
            +  if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) {
            +    return 0;
            +  }
             #endif
             
               return my_realpath(buf, argv0, 0);
            

            wiz Thomas Klausner added a comment - Thank you for the pointer, Daniel Black! The following diff against 10.11.9 adds support for this, and with it, mariadb-backup does not dump core on startup any longer: --- extra/mariabackup/xtrabackup.cc.orig 2024-08-03 07:29:56.000000000 +0000 +++ extra/mariabackup/xtrabackup.cc @@ -69,6 +69,11 @@ Street, Fifth Floor, Boston, MA 02110-13 # include <sys/sysctl.h> #endif   +#ifdef __NetBSD__ +# include <sys/param.h> +# include <sys/sysctl.h> +#endif + #include "aria_backup_client.h"   #include <btr0sea.h> @@ -7690,6 +7695,11 @@ static int get_exepath( char *buf, size_t if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { return 0; } +#elif defined(__NetBSD__) + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME }; + if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { + return 0; + } #endif   return my_realpath(buf, argv0, 0);
            danblack Daniel Black added a comment -

            Thanks wiz for your implementation. I've included it in https://github.com/MariaDB/server/pull/3545.

            danblack Daniel Black added a comment - Thanks wiz for your implementation. I've included it in https://github.com/MariaDB/server/pull/3545 .

            Accidentally closed the wrong ticket, reopened.

            TheLinuxJedi Andrew Hutchings (Inactive) added a comment - Accidentally closed the wrong ticket, reopened.

            People

              danblack Daniel Black
              wiz Thomas Klausner
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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