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

Thread stack overrun: 8366744 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.". Some plugins may be not loaded

Details

    • Bug
    • Status: Needs Feedback (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 11.4.4, 11.4.5, 10.5, 10.6, 10.11
    • 10.11, 11.4, 11.8
    • Server
    • None
    • Linux LibreELEC

    Description

      With 11.4.3 the server starts correctly with a 256K thread_stack but with 11.4.4 and 11.4.5 the error of 8M is occurring. This was reported by one of our users when we updated the package from 11.4.3 to 11.4.5. We have subsequently tested the builds and if was introduced in 11.4.4, rolling back to 11.4.3 (with no other changes to the development and runtime environment allows this to be reproduced.)

      https://github.com/LibreELEC/LibreELEC.tv/pull/9776
      https://forum.libreelec.tv/thread/29487-mariadb-addon-not-starting/

      2025-02-09 12:24:24 0 [Note] Starting MariaDB 11.4.5-MariaDB source revision 0771110266ff5c04216af4bf1243c65f8c67ccf4 server_uid InfkWh78H903mx/MLA8UkYYTjsY= as process 3504997
      2025-02-09 12:24:24 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
      2025-02-09 12:24:24 0 [Note] InnoDB: Number of transaction pools: 1
      2025-02-09 12:24:24 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2025-02-09 12:24:24 0 [Note] InnoDB: Using Linux native AIO
      2025-02-09 12:24:24 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB
      2025-02-09 12:24:24 0 [Note] InnoDB: Completed initialization of buffer pool
      2025-02-09 12:24:24 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
      2025-02-09 12:24:24 0 [Note] InnoDB: End of log at LSN=481118
      2025-02-09 12:24:24 0 [Note] InnoDB: Opened 3 undo tablespaces
      2025-02-09 12:24:24 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
      2025-02-09 12:24:24 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
      2025-02-09 12:24:24 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
      2025-02-09 12:24:24 0 [Note] InnoDB: log sequence number 481118; transaction id 941
      2025-02-09 12:24:24 0 [Note] Plugin 'FEEDBACK' is disabled.
      2025-02-09 12:24:24 0 [Note] Plugin 'wsrep-provider' is disabled.
      2025-02-09 12:24:24 0 [Note] InnoDB: Loading buffer pool(s) from /storage/.kodi/userdata/addon_data/service.mariadb/data/ib_buffer_pool
      2025-02-09 12:24:24 0 [ERROR] Could not open mysql.plugin table: "Thread stack overrun:  8366744 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.". Some plugins may be not loaded
      2025-02-09 12:24:24 0 [Note] InnoDB: Buffer pool(s) load completed at 250209 12:24:24
      2025-02-09 12:24:24 0 [ERROR] Can't open and lock privilege tables: Thread stack overrun:  8368904 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.
      2025-02-09 12:24:24 0 [Note] Server socket created on IP: '0.0.0.0'.
      2025-02-09 12:24:24 0 [Note] Server socket created on IP: '::'.
      2025-02-09 12:24:24 0 [ERROR] Fatal error: Can't open and lock privilege tables: Thread stack overrun:  8348984 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.
      2025-02-09 12:24:24 0 [ERROR] Aborting

      Attachments

        Activity

          elenst Elena Stepanova added a comment - - edited

          Thanks for the report.

          I could reproduce it on a LibreELEC installation.

          The minimal required thread_stack size there just to start MariaDB appears to be ~12M with otherwise default settings, but it doesn't work anyway, even the simple queries throw the error

          MariaDB [(none)]> select @@thread_stack;
          ERROR 1436 (HY000): Thread stack overrun:  12575864 bytes used of a 12582912 byte stack, and 32000 bytes needed. Consider increasing the thread_stack system variable.
          

          and with 15M it just becomes

          MariaDB [(none)]> select @@thread_stack;
          ERROR 1436 (HY000): Thread stack overrun:  15721592 bytes used of a 15728640 byte stack, and 32000 bytes needed. Consider increasing the thread_stack system variable.
          

          I suppose the main suspect is

          commit bddbef3573349b0565c43c27beba47c89358f39f
          Author: Monty
          Date:   Tue Oct 1 17:07:48 2024 +0300
           
              MDEV-34533 asan error about stack overflow when writing record in Aria
          

          which brought a lot of changes to thread stack handling.

          heitbaum,
          Could you please advise (or point at the right online sources maybe) how to build/install a custom version of MariaDB in LibreELEC, which we may need to do in order to verify the fix when it's available?
          I've installed MariaDB as an Add-on, and I see several builds in the add-on repository, but so far I can't see how to install any other build apart from the listed ones.

          elenst Elena Stepanova added a comment - - edited Thanks for the report. I could reproduce it on a LibreELEC installation. The minimal required thread_stack size there just to start MariaDB appears to be ~12M with otherwise default settings, but it doesn't work anyway, even the simple queries throw the error MariaDB [(none)]> select @@thread_stack; ERROR 1436 (HY000): Thread stack overrun: 12575864 bytes used of a 12582912 byte stack, and 32000 bytes needed. Consider increasing the thread_stack system variable. and with 15M it just becomes MariaDB [(none)]> select @@thread_stack; ERROR 1436 (HY000): Thread stack overrun: 15721592 bytes used of a 15728640 byte stack, and 32000 bytes needed. Consider increasing the thread_stack system variable. I suppose the main suspect is commit bddbef3573349b0565c43c27beba47c89358f39f Author: Monty Date: Tue Oct 1 17:07:48 2024 +0300   MDEV-34533 asan error about stack overflow when writing record in Aria which brought a lot of changes to thread stack handling. heitbaum , Could you please advise (or point at the right online sources maybe) how to build/install a custom version of MariaDB in LibreELEC, which we may need to do in order to verify the fix when it's available? I've installed MariaDB as an Add-on, and I see several builds in the add-on repository, but so far I can't see how to install any other build apart from the listed ones.
          changqing Changqing Li added a comment - - edited

          I can reproduce this issue with yocto project, systemd service mysqld will start failed with error:

          2025-02-12  3:18:19 0 [ERROR] Could not open mysql.plugin table: "Thread stack overrun:  16752824 bytes used of a 299008 byte stack, and 81920 by
          

          after set thread_stack = 18M in my.cnf, mysqld can start successfully.

          it can be reproduced with version 11.4.4, and 10.11.10, and version 10.11.9 don't have this issue.

          @Monty, could you help to check if it is related to following commit?

          commit bddbef3573349b0565c43c27beba47c89358f39f
           
          Author: Monty
           
          Date:   Tue Oct 1 17:07:48 2024 +0300
           
           
              MDEV-34533 asan error about stack overflow when writing record in Aria
          

          changqing Changqing Li added a comment - - edited I can reproduce this issue with yocto project, systemd service mysqld will start failed with error: 2025 - 02 - 12 3 : 18 : 19 0 [ERROR] Could not open mysql.plugin table: "Thread stack overrun: 16752824 bytes used of a 299008 byte stack, and 81920 by after set thread_stack = 18M in my.cnf, mysqld can start successfully. it can be reproduced with version 11.4.4, and 10.11.10, and version 10.11.9 don't have this issue. @Monty, could you help to check if it is related to following commit? commit bddbef3573349b0565c43c27beba47c89358f39f   Author: Monty   Date: Tue Oct 1 17 : 07 : 48 2024 + 0300   MDEV- 34533 asan error about stack overflow when writing record in Aria
          changqing Changqing Li added a comment - - edited

          My problem maybe caused by wrong STACK_DIRECTION is passed. I am using x86-64, it should be STACK_DIRECTION=-1, but STACK_DIRECTION=1 is passed. after I remove -D STACK_DIRECTION=1, cmake will determine STACK_DIRECTION automatially with STACK_DIRECTION=-1, then mysqld can start successfully.

          And this also means that for 10.11.9, even with wrong STACK_DIRECTION=1, mysqld can be started, and basic function like create database, insert table all works well.

          changqing Changqing Li added a comment - - edited My problem maybe caused by wrong STACK_DIRECTION is passed. I am using x86-64, it should be STACK_DIRECTION=-1, but STACK_DIRECTION=1 is passed. after I remove -D STACK_DIRECTION=1, cmake will determine STACK_DIRECTION automatially with STACK_DIRECTION=-1, then mysqld can start successfully. And this also means that for 10.11.9, even with wrong STACK_DIRECTION=1, mysqld can be started, and basic function like create database, insert table all works well.
          changqing Changqing Li added a comment - - edited

          PS:
          According to:
          https://github.com/MariaDB/server/blob/main/configure.cmake#L668
          https://github.com/MariaDB/server/blob/main/include/my_sys.h#L1021

          STACK_DIRECTION = 1 means stack grow upwards
          STACK_DIRECTION = -1 means stack grow downwards

          right?

          but according to comments below, seems STACK_DIRECTION = 1 means downgards.
          this is a typo mistake, right?
          https://github.com/MariaDB/server/blob/main/mysys/my_stack.c#L22

          changqing Changqing Li added a comment - - edited PS: According to: https://github.com/MariaDB/server/blob/main/configure.cmake#L668 https://github.com/MariaDB/server/blob/main/include/my_sys.h#L1021 STACK_DIRECTION = 1 means stack grow upwards STACK_DIRECTION = -1 means stack grow downwards right? but according to comments below, seems STACK_DIRECTION = 1 means downgards. this is a typo mistake, right? https://github.com/MariaDB/server/blob/main/mysys/my_stack.c#L22
          heitbaum Rudi Heitbaum added a comment - - edited

          Tested with 11.8.1 and still erroring.

          2025-03-17 12:29:40 0 [ERROR] Fatal error: Can't open and lock privilege tables: Thread stack overrun:  8344488 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.
          2025-03-17 12:29:40 0 [ERROR] Aborting
          2025-03-17 12:29:50 0 [Note] Starting MariaDB 11.8.1-MariaDB source revision 1c4aed7c680c0402d6e97e097f03815c0e9bf4c5 server_uid InfkWh78H903mx/MLA8UkYYTjsY= as process 823524
          2025-03-17 12:29:50 0 [Warning] --innodb-file-per-table is deprecated and will be removed in a future release
          2025-03-17 12:29:50 0 [Warning] --innodb-flush-method is deprecated and will be removed in a future release
          2025-03-17 12:29:50 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
          2025-03-17 12:29:50 0 [Note] InnoDB: Number of transaction pools: 1
          2025-03-17 12:29:50 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
          2025-03-17 12:29:50 0 [Note] InnoDB: Using Linux native AIO
          2025-03-17 12:29:50 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB
          2025-03-17 12:29:50 0 [Note] InnoDB: Completed initialization of buffer pool
          2025-03-17 12:29:50 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
          2025-03-17 12:29:50 0 [Note] InnoDB: End of log at LSN=481118
          2025-03-17 12:29:50 0 [Note] InnoDB: Opened 3 undo tablespaces
          2025-03-17 12:29:50 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
          2025-03-17 12:29:50 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
          2025-03-17 12:29:50 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
          2025-03-17 12:29:50 0 [Note] InnoDB: log sequence number 481118; transaction id 941
          2025-03-17 12:29:50 0 [Note] Plugin 'FEEDBACK' is disabled.
          2025-03-17 12:29:50 0 [Note] Plugin 'wsrep-provider' is disabled.
          2025-03-17 12:29:50 0 [Note] InnoDB: Loading buffer pool(s) from /storage/.kodi/userdata/addon_data/service.mariadb/data/ib_buffer_pool
          2025-03-17 12:29:50 0 [ERROR] Could not open mysql.plugin table: "Thread stack overrun:  8367432 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.". Some plugins may be not loaded
          2025-03-17 12:29:50 0 [Note] InnoDB: Buffer pool(s) load completed at 250317 12:29:50
          2025-03-17 12:29:50 0 [ERROR] Can't open and lock privilege tables: Thread stack overrun:  8369224 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.
          2025-03-17 12:29:50 0 [Note] Server socket created on IP: '0.0.0.0'.
          2025-03-17 12:29:50 0 [Note] Server socket created on IP: '::'.
          2025-03-17 12:29:50 0 [ERROR] Fatal error: Can't open and lock privilege tables: Thread stack overrun:  8349208 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.
          2025-03-17 12:29:50 0 [ERROR] Aborting

          heitbaum Rudi Heitbaum added a comment - - edited Tested with 11.8.1 and still erroring. 2025-03-17 12:29:40 0 [ERROR] Fatal error: Can't open and lock privilege tables: Thread stack overrun: 8344488 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable. 2025-03-17 12:29:40 0 [ERROR] Aborting 2025-03-17 12:29:50 0 [Note] Starting MariaDB 11.8.1-MariaDB source revision 1c4aed7c680c0402d6e97e097f03815c0e9bf4c5 server_uid InfkWh78H903mx/MLA8UkYYTjsY= as process 823524 2025-03-17 12:29:50 0 [Warning] --innodb-file-per-table is deprecated and will be removed in a future release 2025-03-17 12:29:50 0 [Warning] --innodb-flush-method is deprecated and will be removed in a future release 2025-03-17 12:29:50 0 [Note] InnoDB: Compressed tables use zlib 1.3.1 2025-03-17 12:29:50 0 [Note] InnoDB: Number of transaction pools: 1 2025-03-17 12:29:50 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions 2025-03-17 12:29:50 0 [Note] InnoDB: Using Linux native AIO 2025-03-17 12:29:50 0 [Note] InnoDB: Initializing buffer pool, total size = 256.000MiB, chunk size = 4.000MiB 2025-03-17 12:29:50 0 [Note] InnoDB: Completed initialization of buffer pool 2025-03-17 12:29:50 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes) 2025-03-17 12:29:50 0 [Note] InnoDB: End of log at LSN=481118 2025-03-17 12:29:50 0 [Note] InnoDB: Opened 3 undo tablespaces 2025-03-17 12:29:50 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active. 2025-03-17 12:29:50 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ... 2025-03-17 12:29:50 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB. 2025-03-17 12:29:50 0 [Note] InnoDB: log sequence number 481118; transaction id 941 2025-03-17 12:29:50 0 [Note] Plugin 'FEEDBACK' is disabled. 2025-03-17 12:29:50 0 [Note] Plugin 'wsrep-provider' is disabled. 2025-03-17 12:29:50 0 [Note] InnoDB: Loading buffer pool(s) from /storage/.kodi/userdata/addon_data/service.mariadb/data/ib_buffer_pool 2025-03-17 12:29:50 0 [ERROR] Could not open mysql.plugin table: "Thread stack overrun: 8367432 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable.". Some plugins may be not loaded 2025-03-17 12:29:50 0 [Note] InnoDB: Buffer pool(s) load completed at 250317 12:29:50 2025-03-17 12:29:50 0 [ERROR] Can't open and lock privilege tables: Thread stack overrun: 8369224 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable. 2025-03-17 12:29:50 0 [Note] Server socket created on IP: '0.0.0.0'. 2025-03-17 12:29:50 0 [Note] Server socket created on IP: '::'. 2025-03-17 12:29:50 0 [ERROR] Fatal error: Can't open and lock privilege tables: Thread stack overrun: 8349208 bytes used of a 299008 byte stack, and 81920 bytes needed. Consider increasing the thread_stack system variable. 2025-03-17 12:29:50 0 [ERROR] Aborting

          heitbaum, could you please answer the question in the first comment? Thanks!

          serg Sergei Golubchik added a comment - heitbaum , could you please answer the question in the first comment? Thanks!

          People

            monty Michael Widenius
            heitbaum Rudi Heitbaum
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.