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

negative values on system variables longer equate to their maximium value

    XMLWordPrintable

    Details

      Description

      # mysqld options required for replay:  --innodb-buffer-pool-size=-1
      

      Leads to a standard OOM:

      10.5.3 364e7a9ae6b5fbf69494cec30733b5ad28738cbb

      Core was generated by `/test/MD110420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --lc-me'.
      Program terminated with signal SIGABRT, Aborted.
      #0  0x00007f7158c64187 in kill () at ../sysdeps/unix/syscall-template.S:78
      [Current thread is 1 (Thread 0x7f715a5ee7c0 (LWP 16677))]
      (gdb) bt
      #0  0x00007f7158c64187 in kill () at ../sysdeps/unix/syscall-template.S:78
      #1  0x000056455d022df4 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:341
      #2  <signal handler called>
      #3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #4  0x00007f7158c65801 in __GI_abort () at abort.c:79
      #5  0x000056455d63b5ac in ib::fatal_or_error::~fatal_or_error (this=0x7ffccfaa4420, __in_chrg=<optimized out>) at /test/10.5_dbg/storage/innobase/ut/ut0ut.cc:618
      #6  0x000056455d401132 in ut_allocator<unsigned char, true>::allocate (this=this@entry=0x7ffccfaa4600, n_elements=3298534883328, file=file@entry=0x56455dd10600 "/test/10.5_dbg/storage/innobase/buf/buf0buf.cc", set_to_zero=set_to_zero@entry=true, throw_on_error=throw_on_error@entry=false) at /test/10.5_dbg/storage/innobase/include/ut0new.h:384
      #7  0x000056455d6b7210 in buf_pool_t::create (this=0x56455e53c020 <buf_pool>) at /test/10.5_dbg/storage/innobase/buf/buf0buf.cc:1515
      #8  0x000056455d5d16bd in srv_start (create_new_db=<optimized out>) at /test/10.5_dbg/storage/innobase/srv/srv0start.cc:1311
      #9  0x000056455d3f6a93 in innodb_init (p=<optimized out>) at /test/10.5_dbg/storage/innobase/handler/ha_innodb.cc:4058
      #10 0x000056455d027616 in ha_initialize_handlerton (plugin=0x7f7158186eb0) at /test/10.5_dbg/sql/handler.cc:584
      #11 0x000056455cd9546d in plugin_initialize (tmp_root=tmp_root@entry=0x7ffccfaaac10, plugin=plugin@entry=0x7f7158186eb0, argc=argc@entry=0x56455e5bee40 <remaining_argc>, argv=argv@entry=0x7f7158040448, options_only=<optimized out>) at /test/10.5_dbg/sql/sql_plugin.cc:1459
      #12 0x000056455cd96f34 in plugin_init (argc=argc@entry=0x56455e5bee40 <remaining_argc>, argv=<optimized out>, flags=1) at /test/10.5_dbg/sql/sql_plugin.cc:1752
      #13 0x000056455cc77c67 in init_server_components () at /test/10.5_dbg/sql/mysqld.cc:4995
      #14 0x000056455cc7e604 in mysqld_main (argc=<optimized out>, argv=<optimized out>) at /test/10.5_dbg/sql/mysqld.cc:5544
      #15 0x000056455cc70823 in main (argc=<optimized out>, argv=<optimized out>) at /test/10.5_dbg/sql/main.cc:25
      

      Due to:

      2020-04-11  1:51:28 0 [Note] InnoDB: Initializing buffer pool, total size = 9223372036854775808, chunk size = 134217728
      2020-04-11  1:51:59 0 [ERROR] mysqld: Can't lock aria control file '/ram/MD080420-mariadb-10.5.3-linux-x86_64-dbg/data/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
      2020-04-11  1:52:27 0 [ERROR] [FATAL] InnoDB: Cannot allocate 3298534883352 bytes of memory after 60 retries over 60 seconds. OS error: Cannot allocate memory (12). Check if you should increase the swap file or ulimits of your operating system. Note that on most 32-bit computers the process memory space is limited to 2 GB or 4 GB.
      

      Not sure where the 9223372036854775808 value comes from, but that (or the 3298534883352) would seem to be what causes the oversized alloc and subsequent OOM.

      Also not sure why in the error log above the Aria error (Can't lock...) is there (no other instance running there);

      $ ./bin/perror 11
      OS error code  11:  Resource temporarily unavailable
      

      This error does not appear when the server is started without the innodb-buffer-pool-size=-1 option.

      MariaDB 10.1.45 (dbg) produces the following instead of OOM;

      2020-04-11  1:43:45 139640253781952 [Warning] option 'innodb-buffer-pool-size': signed value -1 adjusted to 5242880
      

      Bug confirmed present in:
      MariaDB: 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.4.13 (opt), 10.5.3 (dbg), 10.5.3 (opt)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

      Fix ideas? disallow signed values, or sanity check 0 to max, or check data types (difference between versions maybe?), or mirror 10.1/10.2 behavior

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              danblack Daniel Black
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration