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

vcol_info refix during lock_tables() leads to memory leak until table flush

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5, 10.6
    • 10.6
    • Virtual Columns
    • None

    Description

      This is continuation of MDEV-24176

      fix_all_session_vcol_exprs() works on expr_arena which allocates from table memory pool (TABLE::mem_root). Since expr_arena does not free its items until TABLE is destroyed, continuous work with virtual columns under some circumstances (FIXME: get test case from MDEV-16039 or from main.default_session ) leads to memory leak until table is flushed.

      The problem is common to use cases of long-living query arenas (FIXME: get more cases).

      Discover the idea of making temporary query subarena with it's own item free-list. fix_fields() should run on that subarena and freeing its list will not delete items from the master arena. Freeing master arena items list should free subarena list as well. cleanup() procedure should be tied with that temporary subarena and remove all temporary pointers from master items. And either cleanup() process should automatically free temporary subarena or vice versa the subarena initiates cleanup() of master items. The final goal is that after subarena destroy there is no stale pointers in master items.

      Another more straightforward approach is to destroy query arena on each command. The items are transferred to new arena via build_clone(). That approach is coupled with a number of problems: delayed insert, items clone does not do String::copy() for their properties, cached_table cleanup, proper name resolution context, etc. The proof-of-concept in bb-10.2-midenok-MDEV-25794 tries to fix them to some level of success.

      Note that after this fix granular refix via VCOL_NOT_STRICTLY_DETERMINISTIC flags will not be needed.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              midenok Aleksey Midenkov
              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.