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

LP:954262 - Query casues excessive memory consumption

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Thank you for MariaDB 5.3.5-ga

      The attached file contains a reproducer.
      Running against 5.3.5-ga and a pull from bzr against 5.3 yesterday I am able to get mysqld to consume a great deal of memory by running the attached file thus:
      mysql -D test < 20120313_mariadb_5_3_5_out_of_mem.sql

      When memory is exhausted the error reported to the client is:

      1. ERROR 5 (HY000): Out of memory (Needed [digit] bytes)

      and the server error log has:

      [ERROR] mysqld: Out of memory (Needed [digit] bytes)
      [ERROR] Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space

      (I am aware the query should avoid using single quotes around ints.)

      Running bzr pull on:
      Linux 2.6.32-131.6.1.el6.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux

      Using mariadb-5.3.5-ga-Linux-x86_64.tar.gz on:
      Linux l2.6.32-220.el6.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux

      Cheers

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            sanja Oleksandr Byelkin added a comment -

            Re: Query casues excessive memory consumption
            BTW, All such recursive calls should check stack overflow (it is not cause of the problem but could be in theory).

            Show
            sanja Oleksandr Byelkin added a comment - Re: Query casues excessive memory consumption BTW, All such recursive calls should check stack overflow (it is not cause of the problem but could be in theory).
            Hide
            sanja Oleksandr Byelkin added a comment -

            Re: Query casues excessive memory consumption
            in 5.2 tree_or() looks like this:

            tree_or()
            {
            ...
            if (sel_trees_can_be_ored())

            { ... }
            else
            { // everything else }
            return;
            }

            in 5.3 it is
            tree_or()
            {
            ...
            if (sel_trees_can_be_ored())
            { ... }

            // everything else including allocating new objects
            return;
            }

            Show
            sanja Oleksandr Byelkin added a comment - Re: Query casues excessive memory consumption in 5.2 tree_or() looks like this: tree_or() { ... if (sel_trees_can_be_ored()) { ... } else { // everything else } return; } in 5.3 it is tree_or() { ... if (sel_trees_can_be_ored()) { ... } // everything else including allocating new objects return; }
            Hide
            sanja Oleksandr Byelkin added a comment -

            Re: Query casues excessive memory consumption
            The above change was done by WL#24: "index_merge: fair choice between index_merge union and range access"

            Show
            sanja Oleksandr Byelkin added a comment - Re: Query casues excessive memory consumption The above change was done by WL#24: "index_merge: fair choice between index_merge union and range access"
            Hide
            peterstigedwards Peter (Stig) Edwards added a comment -

            Re: Query casues excessive memory consumption
            Thank you very much. I can confirm the fix stops the problem using the isolated reproducers I have. I am holding off retesting MariaDB 5.3 with the actual database where this problem was found because https://bugs.launchpad.net/maria/+bug/954900 was found in the same database.

            Show
            peterstigedwards Peter (Stig) Edwards added a comment - Re: Query casues excessive memory consumption Thank you very much. I can confirm the fix stops the problem using the isolated reproducers I have. I am holding off retesting MariaDB 5.3 with the actual database where this problem was found because https://bugs.launchpad.net/maria/+bug/954900 was found in the same database.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 954262

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 954262

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                peterstigedwards Peter (Stig) Edwards
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: