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

Wrong (negative) values in P_S memory summary tables for memory/sql/global_system_variables

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5.6, 10.5.7
    • 10.5
    • Performance Schema
    • None

    Description

      If we start MariaDB 10.5 with performance_schema enabled:

      openxs@ao756:~/dbs/maria10.5$ bin/mysqld_safe --no-defaults --port=3311 --socket=/tmp/mariadb105.sock --performance_schema=1 &
      [1] 14213
      openxs@ao756:~/dbs/maria10.5$ 201011 13:34:47 mysqld_safe Logging to '/home/openxs/dbs/maria10.5/data/ao756.err'.
      201011 13:34:47 mysqld_safe Starting mariadbd daemon with databases from /home/openxs/dbs/maria10.5/data
      

      and check memory instrumentation summary tables immediately after start we can see negative values for memory/sql/global_system_variables and main thread:

      openxs@ao756:~/dbs/maria10.5$ bin/mysql --socket=/tmp/mariadb105.sock performance_schema
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
       
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 3
      Server version: 10.5.7-MariaDB Source distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [performance_schema]> select * from memory_summary_by_host_by_event_name where current_number_of_bytes_used <0\G
      *************************** 1. row ***************************
                              HOST: NULL
                        EVENT_NAME: memory/sql/global_system_variables
                       COUNT_ALLOC: 0
                        COUNT_FREE: 2
         SUM_NUMBER_OF_BYTES_ALLOC: 0
          SUM_NUMBER_OF_BYTES_FREE: 128
                    LOW_COUNT_USED: -2
                CURRENT_COUNT_USED: -2
                   HIGH_COUNT_USED: 0
          LOW_NUMBER_OF_BYTES_USED: -128
      CURRENT_NUMBER_OF_BYTES_USED: -128
         HIGH_NUMBER_OF_BYTES_USED: 0
      1 row in set (0,002 sec)
       
      MariaDB [performance_schema]> select * from memory_summary_by_thread_by_event_name where current_number_of_bytes_used <0\G
      *************************** 1. row ***************************
                         THREAD_ID: 1
                        EVENT_NAME: memory/sql/global_system_variables
                       COUNT_ALLOC: 0
                        COUNT_FREE: 2
         SUM_NUMBER_OF_BYTES_ALLOC: 0
          SUM_NUMBER_OF_BYTES_FREE: 128
                    LOW_COUNT_USED: -2
                CURRENT_COUNT_USED: -2
                   HIGH_COUNT_USED: 0
          LOW_NUMBER_OF_BYTES_USED: -128
      CURRENT_NUMBER_OF_BYTES_USED: -128
         HIGH_NUMBER_OF_BYTES_USED: 0
      1 row in set (0,004 sec)
       
      MariaDB [performance_schema]> select t.*, m.* from memory_summary_by_thread_by_event_name m join threads t on m.thread_id = t.thread_id where current_number_of_bytes_used <0\G
      *************************** 1. row ***************************
                         THREAD_ID: 1
                              NAME: thread/sql/main
                              TYPE: BACKGROUND
                    PROCESSLIST_ID: NULL
                  PROCESSLIST_USER: NULL
                  PROCESSLIST_HOST: NULL
                    PROCESSLIST_DB: mysql
               PROCESSLIST_COMMAND: NULL
                  PROCESSLIST_TIME: 105
                 PROCESSLIST_STATE: NULL
                  PROCESSLIST_INFO: NULL
                  PARENT_THREAD_ID: NULL
                              ROLE: NULL
                      INSTRUMENTED: YES
                           HISTORY: YES
                   CONNECTION_TYPE: Error
                      THREAD_OS_ID: 14292
                         THREAD_ID: 1
                        EVENT_NAME: memory/sql/global_system_variables
                       COUNT_ALLOC: 0
                        COUNT_FREE: 2
         SUM_NUMBER_OF_BYTES_ALLOC: 0
          SUM_NUMBER_OF_BYTES_FREE: 128
                    LOW_COUNT_USED: -2
                CURRENT_COUNT_USED: -2
                   HIGH_COUNT_USED: 0
          LOW_NUMBER_OF_BYTES_USED: -128
      CURRENT_NUMBER_OF_BYTES_USED: -128
         HIGH_NUMBER_OF_BYTES_USED: 0
      1 row in set (0,003 sec)
      

      From the above we seem to see that something was freed twice and never allocated. This is either bug in memory instrumentation, or in the way server gets data from the summary tables, or we really freed some memory that was never allocated (and it may be a more serious bug). We should never see negative values in these tables.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            valerii Valerii Kravchuk
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.