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

Memory leak after upgrading from 10.4 to 10.6

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.15, 10.6.16
    • None
    • None
    • None
    • MariaDB 10.6.15 and .16 on FreeBSD 12.4

    Description

      After upgrading from 10.4.29 to 10.6.15 (and then 10.6.16) I'm observing huge memory leak probably related to FTS.

      As calculated by mytuner.pl max memory usage should be around 20GB (and it was like that on 10.4) - with the leak memory can grow up to 90GB within few hours. Attached example graph of memory usage. Database is mostly innodb.

      Observations I made:

      • leak seems to be SELECT related, because on replicas memory doesn't leak (replicase are used only for backups etc. - SELECTs are generally not executed on them).
      • jumps are sometimes pretty high, i.e. it can leak 10GB in 1 minute
      • I extracted SELECTs from general log (10 minutes set, ~120k queries) and rerun them on replica - it caused immediate grow of allocated memory.
      • These queries were originally executed as Prepared Statements but in this test they were run as-is (as saved in the log)
      • I started checking memory size after each query - it seems that SELECT..MATCH..AGAINST is causing trouble.
      • repeating same query didn't cause additional leak
      • switching the table with FTS index from Innodb to MyISAM limited the problem - i.e. after 24h I can observe 10GB leak (with Innodb it was over 100GB in 8 hours)

      Table used is like that:

      CREATE TABLE `kt_index` (
             `id_kt` varchar(32) NOT NULL,
             `id_kl` varchar(32) NOT NULL,
             `f1` varchar(255) NOT NULL,
             `f2` varchar(255) DEFAULT NULL,
             `f3` varchar(255) DEFAULT NULL,
             `f4` varchar(255) DEFAULT NULL,
             `k1` tinyint(1) DEFAULT NULL,
             `k2` tinyint(1) DEFAULT NULL,
             `k3` tinyint(1) DEFAULT NULL,
             `k4` tinyint(1) DEFAULT NULL,
             `k5` int(11) NOT NULL DEFAULT 1,
             `k6` int(11) NOT NULL DEFAULT 1,
             PRIMARY KEY (`id_kt`),
             KEY `kt_indeks_search` (`id_kl`,`k1`,`k2`),
             FULLTEXT KEY `xname` (`f1`,`f2`,`f3`,`f4`)
           ) ENGINE=Innodb DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
      

      Queries that seems to cause leak are 99% like that:

      SELECT kti.id_kl id, 'xyz' label, kti.f1 value, 'K' group_name, kti.f3, kti.f4 FROM kt_index kti LEFT JOIN kl ON kl.id_kl = kti.id_kl WHERE MATCH (kti.f1,kti.f2,kti.f3,kti.f4) AGAINST (? IN BOOLEAN MODE) GROUP BY kti.id_kl ORDER BY kti.f1 ASC LIMIT 20;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            marcin.gryszkalis Marcin Gryszkalis
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.