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

Crash triggered by procedure

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.3
    • 12.3
    • None
    • None

    Description

      Hi,

      I found that MariaDB can be crashed by a procedure.

      This test case can trigger this:

      CREATE TABLE t1(a INT);
      INSERT INTO t1 VALUES (1);
       
      DELIMITER //
      CREATE OR REPLACE PROCEDURE p_space()
      BEGIN
        DECLARE c sys_refcursor;
        OPEN c FOR SELECT a FROM t1;
        CLOSE c;
      END//
       
      CREATE OR REPLACE PROCEDURE p_newline()
      BEGIN
        DECLARE c sys_refcursor;
        OPEN c FOR
      SELECT a FROM t1;
        CLOSE c;
      END//
      DELIMITER ;
       
      CALL p_space();
      CALL p_newline();
       
      ALTER TABLE t1 MODIFY a SMALLINT;
      SELECT 'after alter' AS marker;
       
      CALL p_space();
      CALL p_newline();
      

      This is the output:

      2026-05-17 15:31:47 0 [Note] Starting MariaDB 13.0.1-MariaDB-debug-log source revision f6e44c1b7819f9befa3824f07866822288231528 server_uid CqDI0oxj3CPSogZgomcEQTQehSs= as process 2046731
      2026-05-17 15:31:47 0 [Note] Help others discover MariaDB. Star it on GitHub: https://github.com/MariaDB/server
      2026-05-17 15:31:47 0 [Note] InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
      2026-05-17 15:31:47 0 [Note] InnoDB: Compressed tables use zlib 1.3
      2026-05-17 15:31:47 0 [Note] InnoDB: Number of transaction pools: 1
      2026-05-17 15:31:47 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
      2026-05-17 15:31:47 0 [Note] InnoDB: innodb_buffer_pool_size_max=8388608m, innodb_buffer_pool_size=128m
      2026-05-17 15:31:47 0 [Note] InnoDB: Initialized memory pressure event listener
      2026-05-17 15:31:47 0 [Note] InnoDB: Completed initialization of buffer pool
      2026-05-17 15:31:47 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
      2026-05-17 15:31:47 0 [Note] InnoDB: End of log at LSN=51978
      2026-05-17 15:31:47 0 [Note] InnoDB: Opened 3 undo tablespaces
      2026-05-17 15:31:47 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
      2026-05-17 15:31:47 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
      2026-05-17 15:31:47 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
      2026-05-17 15:31:47 0 [Note] InnoDB: log sequence number 51978; transaction id 14
      2026-05-17 15:31:47 0 [Note] InnoDB: Loading buffer pool(s) from /home/zhangchi/data/mariadbRep/verify-run/issue08-20260517-153144/datadir/ib_buffer_pool
      2026-05-17 15:31:47 0 [Note] Plugin 'FEEDBACK' is disabled.
      2026-05-17 15:31:47 0 [Note] Plugin 'wsrep-provider' is disabled.
      2026-05-17 15:31:47 0 [Note] InnoDB: Buffer pool(s) load completed at 260517 15:31:47
      2026-05-17 15:31:51 0 [Note] Server socket created on IP: '127.0.0.1', port: '3468'.
      2026-05-17 15:31:51 0 [Warning] 'user' entry 'root@zhangchi-standard-pc-i440fx-piix-1996' ignored in --skip-name-resolve mode.
      2026-05-17 15:31:51 0 [Warning] 'proxies_priv' entry '@% root@zhangchi-standard-pc-i440fx-piix-1996' ignored in --skip-name-resolve mode.
      2026-05-17 15:31:51 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
      2026-05-17 15:31:51 0 [Note] build-debug/sql/mariadbd: ready for connections.
      Version: '13.0.1-MariaDB-debug-log'  socket: '/home/zhangchi/data/mariadbRep/verify-run/issue08-20260517-153144/datadir/mariadb.sock'  port: 3468  Source distribution
      260517 15:31:51 [ERROR] build-debug/sql/mariadbd got signal 11 ;
      Sorry, we probably made a mistake, and this is a bug.
       
      Your assistance in bug reporting will enable us to fix this for the next release.
      To report this bug, see https://mariadb.com/kb/en/reporting-bugs about how to report
      a bug on https://jira.mariadb.org/.
       
      Please include the information from the server start above, to the end of the
      information below.
       
      Server version: 13.0.1-MariaDB-debug-log source revision: f6e44c1b7819f9befa3824f07866822288231528
       
      The information page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/
      contains instructions to obtain a better version of the backtrace below.
      Following these instructions will help MariaDB developers provide a fix quicker.
       
      Attempting backtrace. Include this in the bug report.
      (note: Retrieving this information may fail)
       
      Thread pointer: 0x75ee90000dc8
      stack_bottom = 0x7deee4086000 thread_stack 0x49000
      addr2line: 'build-debug/sql/mariadbd': No such file
      Printing to addr2line failed
      build-debug/sql/mariadbd(my_print_stacktrace+0x44)[0x589a6a129be9]
      build-debug/sql/mariadbd(handle_fatal_signal+0x265)[0x589a696181c2]
      libc_sigaction.c:0(__restore_rt)[0x7deee5a45330]
      addr2line: 'build-debug/sql/mariadbd': No such file
      build-debug/sql/mariadbd(_ZN11sp_pcontextD1Ev+0x35)[0x589a68ff5605]
      build-debug/sql/mariadbd(_ZN11sp_pcontextD1Ev+0x45)[0x589a68ff5615]
      build-debug/sql/mariadbd(_ZN11sp_pcontextD1Ev+0x45)[0x589a68ff5615]
      build-debug/sql/mariadbd(_ZN7sp_headD1Ev+0x143)[0x589a68fe4ab1]
      build-debug/sql/mariadbd(_ZN7sp_headD0Ev+0x1c)[0x589a68fe4b62]
      build-debug/sql/mariadbd(_ZN7sp_head7destroyEPS_+0xcd)[0x589a68fe2d25]
      build-debug/sql/mariadbd(hash_free_sp_head+0x24)[0x589a68fdf9b6]
      build-debug/sql/mariadbd(+0x1cc06ec)[0x589a6a0f46ec]
      build-debug/sql/mariadbd(my_hash_free+0x7c)[0x589a6a0f4777]
      build-debug/sql/mariadbd(_ZN8sp_cacheD1Ev+0x1c)[0x589a68fdf9f6]
      build-debug/sql/mariadbd(_Z14sp_cache_clearPP8sp_cache+0x34)[0x589a68fdf560]
      build-debug/sql/mariadbd(_ZN9Sp_caches15sp_caches_clearEv+0x20)[0x589a68fdfaba]
      build-debug/sql/mariadbd(_ZN3THD7cleanupEv+0x3fe)[0x589a69077934]
      build-debug/sql/mariadbd(_Z10unlink_thdP3THD+0x7a)[0x589a68f1853e]
      build-debug/sql/mariadbd(_Z24do_handle_one_connectionP7CONNECTb+0x1f0)[0x589a6937060e]
      build-debug/sql/mariadbd(handle_one_connection+0x6e)[0x589a69370310]
      build-debug/sql/mariadbd(+0x15afba0)[0x589a699e3ba0]
      nptl/pthread_create.c:447(start_thread)[0x7deee5a9caa4]
      x86_64/clone3.S:80(clone3)[0x7deee5b29c6c]
       
      Connection ID (thread ID): 6
      Status: KILL_CONNECTION
      Query (0x0): (null)
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,duplicateweedout=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on,cset_narrowing=on,sargable_casefold=on,reorder_outer_joins=off
       
      Writing a core file...
      Working directory at /home/zhangchi/data/mariadbRep/verify-run/issue08-20260517-153144/datadir
      Resource Limits (excludes unlimited resources):
      Limit                     Soft Limit           Hard Limit           Units
      Max stack size            8388608              unlimited            bytes
      Max core file size        0                    unlimited            bytes
      Max processes             1030442              1030442              processes
      Max open files            1048576              1048576              files
      Max locked memory         33776824320          33776824320          bytes
      Max pending signals       1030442              1030442              signals
      Max msgqueue size         819200               819200               bytes
      Max nice priority         0                    0
      Max realtime priority     0                    0
      Core pattern: core
       
      Kernel version: Linux version 6.17.0-19-generic (buildd@lcy02-amd64-019) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar  6 23:08:46 UTC 2
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.