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

MariaDB crashes when compiled with link time optimizations

Details

    Description

      Following the release of MariaDB 10.5.10 on Hirsute, we have discovered that appending -flto and -ffat-lto-objects as compile flags will cause MariaDB to crash with SIGABRT in pthread_exit when closing the replication slave thread.

      This is happens regardless if MariaDB is compiled with PERFSCHEMA or not.

      Steps to reproduce:

      Set up an Ubuntu 21.04 docker container or VM.

      run

      debian/autobake-deb.sh
      

      or

      dpkg-buildpackage --build=binary
      

      from the base server directory.

      Notice the extra -flto and -ffat-lto-objects flags being passed during compilation (and linking).

      Run any replication test such as rpl_sp

      #1  0x00007f5831212864 in __GI_abort () at abort.c:79
      #2  0x000055ffc77d5bc1 in _Unwind_SetGR.cold ()
      #3  0x000055ffc7fa575d in __gcc_personality_v0 ()
      #4  0x00007f5830fb1604 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
      #5  0x00007f5830fb1cf2 in _Unwind_ForcedUnwind () from /lib/x86_64-linux-gnu/libgcc_s.so.1
      #6  0x00007f5831c76d46 in __GI___pthread_unwind (buf=<optimized out>) at unwind.c:131
      #7  0x00007f5831c6e732 in __do_cancel () at pthreadP.h:307
      #8  __pthread_exit (value=value@entry=0x0) at pthread_exit.c:28
      #9  0x000055ffc784b1b3 in handle_slave_sql (arg=0x55ffcb161d00) at ./sql/slave.cc:5298
      #10 0x00007f5831c6d450 in start_thread (arg=0x7f58240dd640) at pthread_create.c:473
      #11 0x00007f5831303d53 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Attachments

        Issue Links

          Activity

            It was fixed, in the sense that it doesn't crash (except for MCOL-5819).

            It looks like only Ubuntu and derivatives are affected, but I think it'd be safer to disable LTO for ColumnStore unconditionally, I'll try that.

            serg Sergei Golubchik added a comment - It was fixed, in the sense that it doesn't crash (except for MCOL-5819 ). It looks like only Ubuntu and derivatives are affected, but I think it'd be safer to disable LTO for ColumnStore unconditionally, I'll try that.

            Was this really fixed in 11.2.6, 11.4.4 and 11.6.2? What is the impact of this revert due to MCOL-5819? Does it only affect Ubuntu packages?

            marko Marko Mäkelä added a comment - Was this really fixed in 11.2.6, 11.4.4 and 11.6.2? What is the impact of this revert due to MCOL-5819 ? Does it only affect Ubuntu packages?
            danblack Daniel Black added a comment -

            Looks good to me. Go ahead.

            danblack Daniel Black added a comment - Looks good to me. Go ahead.

            cherry-picked into 10.6, new commit hashes:

            397762d4e2e don't disable lto in DEB builds
            ea07244d444 MDEV-25633 MariaDB crashes when compiled with link time optimizatio>
            b6cd03d7b04 better disable lto for libmysqld_exports.cc
            2ea6c73a4d2 C/C compilation failures under -flto
            

            branch bb-10.6-MDEV-25633

            serg Sergei Golubchik added a comment - cherry-picked into 10.6, new commit hashes: 397762d4e2e don't disable lto in DEB builds ea07244d444 MDEV-25633 MariaDB crashes when compiled with link time optimizatio> b6cd03d7b04 better disable lto for libmysqld_exports.cc 2ea6c73a4d2 C/C compilation failures under -flto branch bb-10.6- MDEV-25633

            The build log referenced by Otto two comments back still uses -static-libgcc in the compile, so that's why it's still failing, presumably.

            knielsen Kristian Nielsen added a comment - The build log referenced by Otto two comments back still uses -static-libgcc in the compile, so that's why it's still failing, presumably.

            People

              serg Sergei Golubchik
              cvicentiu Vicențiu Ciorbaru
              Votes:
              1 Vote for this issue
              Watchers:
              9 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.