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

Missing DBUG_RETURN on error exits of DML_prelocking_strategy::handle_table() and prepare_fk_prelocking_list()

    XMLWordPrintable

Details

    Description

      DML_prelocking_strategy::handle_table() and prepare_fk_prelocking_list() in sql/sql_base.cc start with DBUG_ENTER, but three of their error exits return with a plain return TRUE;. In a debug build, taking any of them aborts the server at the next DBUG_RETURN up the stack:

      mariadbd: debugger aborting because missing DBUG_RETURN or DBUG_VOID_RETURN macro in function "handle_table"
      

      The three exits, as on main:

      // DML_prelocking_strategy::handle_table()
        if (table_list->trg_event_map && trigger_prelocking_needed)
        {
          if (table->triggers)
          {
            *need_prelocking= TRUE;
       
            if (table->triggers->
                add_tables_and_routines_for_triggers(thd, prelocking_ctx, table_list))
              return TRUE;
          }
       
          if (prepare_fk_prelocking_list(thd, prelocking_ctx, table_list,
                                         need_prelocking,
                                         table_list->trg_event_map))
            return TRUE;
        }
      

      // prepare_fk_prelocking_list()
        table->file->get_parent_foreign_key_list(thd, &fk_list);
        if (unlikely(thd->is_error()))
        {
          if (arena)
            thd->restore_active_arena(arena, &backup);
          return TRUE;
        }
      

      MDEV-31680 is this abort in prepare_fk_prelocking_list, reached from handle_table. It was reproducible on 10.4 to 11.0, and was closed as Cannot Reproduce because its test case no longer gets to this code. Its test case still passes on main. The exits are unchanged on 10.11, 11.4, 11.8, 12.3, 13.1 and main.

      The exits are reached as follows:

      • The second exit in handle_table, together with the one in prepare_fk_prelocking_list, is reached when get_parent_foreign_key_list() leaves an error in the diagnostics area.
      • The second exit in handle_table alone is also reached in a WSREP build when wsrep_foreign_key_append() fails. prepare_fk_prelocking_list returns through DBUG_RETURN(error) on that path.
      • The first exit in handle_table cannot be reached at present, since Table_triggers_list::add_tables_and_routines_for_triggers() has no path that returns TRUE.

      Release builds are not affected: DBUG_ENTER and DBUG_RETURN compile to nothing there.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              arcivanov Arcadiy Ivanov
              Michael Widenius Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Git Integration

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