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

mroonga fails embedded tests in 10.1

Details

    • 10.1.9-3

    Description

      mroonga crashes in embedded tests in 10.1.

      this looks like a linking problem. the crash happens immediately in mrn_init() on

      mrn_hton_ptr = hton;

      In -DCMAKE_BUILD_TYPE=Debug this is compiled to

      	movq	mrn_hton_ptr@GOTPCREL(%rip), %rax
      	movq	-32(%rbp), %rdx
      	movq	%rdx, (%rax)

      And in gdb I see that %rax is 0 in the last line. Other plugins (for example, qc_info plugin) succeed, while having very similar code. I'd guess the issue has something to do with compilation or linking options that mroonga uses.

      As a temporary workaround I have made mroonga tests not to run by default in embedded test runs.

      Attachments

        Activity

          kou Kouhei Sutou added a comment -

          I've fixed it on master in the Mroonga repository: https://github.com/mroonga/mroonga

          I've added "MRN_BUILD_FOR_EMBEDDED_SERVER" CMake option. We need to enable the value by passing "-DMRN_BUILD_FOR_EMBEDDED_SERVER=ON" when we build Mroonga for embedded server.

          Reason: Mroonga uses "THD". "THD" has more fields when it's build for embedded server. (See "#ifdef EMBEDDED_LIBRARY" in sql/sql_class.h.) We need to build Mroonga with "EMBEDDED_LIBRARY" flag for embedded server. The "MRN_BUILD_FOR_EMBEDDED_SERVER" CMake option adds "-DEMBEDDED_LIBRARY" compiler (preprocessor) flag.

          kou Kouhei Sutou added a comment - I've fixed it on master in the Mroonga repository: https://github.com/mroonga/mroonga I've added "MRN_BUILD_FOR_EMBEDDED_SERVER" CMake option. We need to enable the value by passing "-DMRN_BUILD_FOR_EMBEDDED_SERVER=ON" when we build Mroonga for embedded server. Reason: Mroonga uses "THD". "THD" has more fields when it's build for embedded server. (See "#ifdef EMBEDDED_LIBRARY" in sql/sql_class.h.) We need to build Mroonga with "EMBEDDED_LIBRARY" flag for embedded server. The "MRN_BUILD_FOR_EMBEDDED_SERVER" CMake option adds "-DEMBEDDED_LIBRARY" compiler (preprocessor) flag.

          Thanks a lot!

          Does that mean you didn't use THD before 5.04?

          Normally, for engines that use THD our solution is to specify RECOMPILE_FOR_EMBEDDED in MYSQL_ADD_PLUGIN in the CMakeLists.txt. See, for example, storage/myisam/CMakeLists.txt. But this solution only works if the plugin is compiled in statically — cmake will build libmroonga.a to link into mysqld and libmroonga_embedded.a to link into libmysqld.a.

          If the plugin is built as a dynamic module — ha_mroonga.so — there can be only one file and until you use THD directly, this one file cannot work both for the standalone and embedded server, as far as I understand.

          So, for now I'll add RECOMPILE_FOR_EMBEDDED for mroonga and I'll enable embedded tests for mroonga but only when mroonga is built in statically.

          If you'd like to consider removing dependency on THD, I'd be happy to help with that too. Please, tell me what you use THD for and I'll see what we can do about it.

          serg Sergei Golubchik added a comment - Thanks a lot! Does that mean you didn't use THD before 5.04? Normally, for engines that use THD our solution is to specify RECOMPILE_FOR_EMBEDDED in MYSQL_ADD_PLUGIN in the CMakeLists.txt . See, for example, storage/myisam/CMakeLists.txt . But this solution only works if the plugin is compiled in statically — cmake will build libmroonga.a to link into mysqld and libmroonga_embedded.a to link into libmysqld.a . If the plugin is built as a dynamic module — ha_mroonga.so — there can be only one file and until you use THD directly, this one file cannot work both for the standalone and embedded server, as far as I understand. So, for now I'll add RECOMPILE_FOR_EMBEDDED for mroonga and I'll enable embedded tests for mroonga but only when mroonga is built in statically . If you'd like to consider removing dependency on THD, I'd be happy to help with that too. Please, tell me what you use THD for and I'll see what we can do about it.
          kou Kouhei Sutou added a comment -

          > Does that mean you didn't use THD before 5.04?

          Mroonga used THD before 5.04.

          The test failure reported in this issue is caused by "unresolved symbol" load error on dlopen() in sql/sql_plugin.cc.

          The symbol was referenced from unused code for MariaDB 10.1 build. It was fixed by disabling the code at https://github.com/mroonga/mroonga/commit/2894292fd908b1bbe59d829e7fdab89e6d751d4d#diff-ba714ec217aa6836e39b3aea9da57ae2R16267

          (Sorry. I forgot the "unresolved symbol" name.)

          > So, for now I'll add RECOMPILE_FOR_EMBEDDED for mroonga and I'll enable embedded tests for mroonga but only when mroonga is built in statically.

          Unfortunately, it doesn't solve anything. Because Mroonga passes MODULE_ONLY flag to mysql_add_plugin():

          https://github.com/MariaDB/server/blob/10.1/storage/mroonga/CMakeLists.txt#L323

          RECOMPILE_FOR_EMBEDDED doesn't work for MODULE_ONLY plugin:

          https://github.com/MariaDB/server/blob/10.1/cmake/plugin.cmake#L122

          > If you'd like to consider removing dependency on THD, I'd be happy to help with that too. Please, tell me what you use THD for and I'll see what we can do about it.

          We want to implement "abort on warning" feature in Mroonga. If we can implement the feature without THD, we don't use THD for the feature.

          EMBEDDED_LIBRARY macro affects THD::abort_on_warning position in THD.

          kou Kouhei Sutou added a comment - > Does that mean you didn't use THD before 5.04? Mroonga used THD before 5.04. The test failure reported in this issue is caused by "unresolved symbol" load error on dlopen() in sql/sql_plugin.cc. The symbol was referenced from unused code for MariaDB 10.1 build. It was fixed by disabling the code at https://github.com/mroonga/mroonga/commit/2894292fd908b1bbe59d829e7fdab89e6d751d4d#diff-ba714ec217aa6836e39b3aea9da57ae2R16267 (Sorry. I forgot the "unresolved symbol" name.) > So, for now I'll add RECOMPILE_FOR_EMBEDDED for mroonga and I'll enable embedded tests for mroonga but only when mroonga is built in statically. Unfortunately, it doesn't solve anything. Because Mroonga passes MODULE_ONLY flag to mysql_add_plugin(): https://github.com/MariaDB/server/blob/10.1/storage/mroonga/CMakeLists.txt#L323 RECOMPILE_FOR_EMBEDDED doesn't work for MODULE_ONLY plugin: https://github.com/MariaDB/server/blob/10.1/cmake/plugin.cmake#L122 > If you'd like to consider removing dependency on THD, I'd be happy to help with that too. Please, tell me what you use THD for and I'll see what we can do about it. We want to implement "abort on warning" feature in Mroonga. If we can implement the feature without THD, we don't use THD for the feature. EMBEDDED_LIBRARY macro affects THD::abort_on_warning position in THD.
          kou Kouhei Sutou added a comment -

          Sorry. I forgot to mention about this: Thanks for your help!

          kou Kouhei Sutou added a comment - Sorry. I forgot to mention about this: Thanks for your help!

          I've tried again and don't think this crash that I see has anything to do with THD. Incorrect offset to THD::abort_on_warning could only cause a crash when you access thd->abort_on_warning or later. But I see a crash immediately in mrn_init()

          serg Sergei Golubchik added a comment - I've tried again and don't think this crash that I see has anything to do with THD. Incorrect offset to THD::abort_on_warning could only cause a crash when you access thd->abort_on_warning or later. But I see a crash immediately in mrn_init()
          kou Kouhei Sutou added a comment -

          Thanks for trying this again. Could you show how to try this again?

          kou Kouhei Sutou added a comment - Thanks for trying this again. Could you show how to try this again?

          People

            serg Sergei Golubchik
            serg Sergei Golubchik
            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.