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

Repeated SHOW STATUS in multi-statement uses a lot of memory

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4.2, 11.5.1
    • None
    • None
    • None

    Description

      When multiple SHOW STATUS are executed in the same SQL query, MariaDB runs out of memory.

      In one terminal, run MariaDB:

      docker run -ti --rm --network=host -e MARIADB_ROOT_PASSWORD=root --name=mdb mariadb:11.4 --max-allowed-packet=$((1024*1024*1024))
      

      Then in another terminal:

      yes "SHOW STATUS WHERE Variable_name IN('Rows_read');"|head -n 1000000|docker exec -i mdb mariadb -uroot -proot --ssl=false --delimiter='$$$$' > /dev/null
      

      Adding --memory=8G --memory-swap=8G to the docker run makes it easier to test this without consuming all of the memory on the host system.

      The relatively massive memory usage can also be reproduced with the default value of max_allowed_packet. On my system with MariaDB 11.4, executing the SQL with 300k lines of the SHOW STATUS command causes the RSS to peak at about 5GiB after which it returns to 300MiB.

      Attachments

        1. dump-show.sql.gz
          5.61 MB
          markus makela
        2. only-show-one-packet.sql.gz
          42 kB
          markus makela
        3. heap-report.pdf
          23 kB
          markus makela

        Activity

          People

            Unassigned Unassigned
            markus makela markus makela
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.