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

concat variables inside stored procedure

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 11.4
    • 11.4.2
    • Stored routines
    • None
    • Ubuntu 20

    Description

      CREATE PROCEDURE called (v VARCHAR(8192) CHARACTER SET utf8)
      BEGIN
      END;
       
      CREATE PROCEDURE caller ()
      BEGIN
        DECLARE v VARCHAR(66) CHARACTER SET utf8 DEFAULT ''; 
        CALL called(CONCAT(v,'.',v));
      END;
       
      call caller();
      

      Result = segmentation fault in server. I know this did not happen with MariaDB 10 and does not happen with MySQL 8.3. I have mariadb-11.4 preview from a few months ago, I failed to install from a community download today, so cannot guarantee it's not solved.

      This is a copy of what's on the server's terminal, starting with where I started the server, ending with the words "Segmentation fault".

      pgulutzan@pgulutzan-VirtualBox:~/Downloads/mariadb-11.4.0-preview-linux-systemd-x86_64$ sudo bin/mysqld --no-defaults --basedir=$HOME/$MARIADB --datadir=$HOME/$MARIADB/data --lc-messages-dir=$HOME/$MARIADB/share --lower-case-table-names=1 --user=root
      bin/mysqld: Deprecated program name. It will be removed in a future release, use '/home/pgulutzan/Downloads/mariadb-11.4.0-preview-linux-systemd-x86_64/bin/mariadbd' instead
      2024-05-26  9:03:14 0 [Note] Starting MariaDB 11.4.0-preview-MariaDB source revision a82ab43fcb5404e1b2ab8744eb34ab717d71b6d9 as process 3687
      2024-05-26  9:03:14 0 [Note] InnoDB: Compressed tables use zlib 1.3
      2024-05-26  9:03:14 0 [Note] InnoDB: Number of transaction pools: 1
      2024-05-26  9:03:14 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2024-05-26  9:03:14 0 [Note] InnoDB: Using Linux native AIO
      2024-05-26  9:03:14 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
      2024-05-26  9:03:14 0 [Note] InnoDB: Completed initialization of buffer pool
      2024-05-26  9:03:14 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
      2024-05-26  9:03:14 0 [Note] InnoDB: End of log at LSN=701913
      2024-05-26  9:03:15 0 [Note] InnoDB: Opened 3 undo tablespaces
      2024-05-26  9:03:15 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
      2024-05-26  9:03:15 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
      2024-05-26  9:03:15 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
      2024-05-26  9:03:15 0 [Note] InnoDB: log sequence number 701913; transaction id 968
      2024-05-26  9:03:15 0 [Note] Plugin 'FEEDBACK' is disabled.
      2024-05-26  9:03:15 0 [Note] Plugin 'wsrep-provider' is disabled.
      2024-05-26  9:03:15 0 [Note] InnoDB: Loading buffer pool(s) from /home/pgulutzan/Downloads/mariadb-11.4.0-preview-linux-systemd-x86_64/data/ib_buffer_pool
      2024-05-26  9:03:15 0 [Note] Server socket created on IP: '0.0.0.0'.
      2024-05-26  9:03:15 0 [Note] Server socket created on IP: '::'.
      2024-05-26  9:03:16 0 [ERROR] Invalid roles_mapping table entry user:'lorinda@%', rolename:'developer'
      2024-05-26  9:03:16 0 [Note] InnoDB: Buffer pool(s) load completed at 240526  9:03:16
      2024-05-26  9:03:16 0 [Note] mysqld: Event Scheduler: Loaded 0 events
      2024-05-26  9:03:16 2 [Note] Reading Master_info: 'master-x.info'  Relay_info:'relay-log-x.info'
      2024-05-26  9:03:16 2 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MariaDB server acts as a replica and has its hostname changed. Please use '--log-basename=#' or '--relay-log=pgulutzan-VirtualBox-relay-bin' to avoid this problem.
      2024-05-26  9:03:16 2 [Note] Initialized Master_info from 'master-x.info'
      2024-05-26  9:03:16 3 [Note] Master 'x': Slave I/O thread: Start asynchronous replication to master '@:3306' in log '' at position 4
      2024-05-26  9:03:16 3 [ERROR] Master 'x': Slave I/O: Fatal error: Invalid (empty) username when attempting to connect to the master server. Connection attempt terminated. Internal MariaDB error code: 1593
      2024-05-26  9:03:16 3 [Note] Master 'x': Slave I/O thread killed while connecting to master
      2024-05-26  9:03:16 3 [Note] Master 'x': Slave I/O thread exiting, read up to log 'FIRST', position 4; GTID position , master :3306
      2024-05-26  9:03:16 4 [Note] Master 'x': Slave SQL thread initialized, starting replication in log 'FIRST' at position 4, relay log './pgulutzan-VirtualBox-relay-bin-x.000001' position: 4; GTID position ''
      2024-05-26  9:03:16 2 [Note] Started replication for 'x'
      2024-05-26  9:03:17 6 [Note] Slave I/O thread: Start asynchronous replication to master 'replication@master2.mycompany.com:3306' in log 'master2-bin.001' at position 4
      2024-05-26  9:03:17 7 [Note] Slave SQL thread initialized, starting replication in log 'master2-bin.001' at position 4, relay log './pgulutzan-VirtualBox-relay-bin.000005' position: 4
      2024-05-26  9:03:17 0 [Note] bin/mysqld: ready for connections.
      Version: '11.4.0-preview-MariaDB'  socket: '/tmp/mysql.sock'  port: 3306  MariaDB Server
      2024-05-26  9:03:17 6 [ERROR] Slave I/O: error connecting to master 'replication@master2.mycompany.com:3306' - retry-time: 10  maximum-retries: 100000  message: Unknown server host 'master2.mycompany.com' (-2), Internal MariaDB error code: 2005
      240526  9:04:20 [ERROR] mysqld 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
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed, 
      something is definitely wrong and this may fail.
       
      Server version: 11.4.0-preview-MariaDB source revision: a82ab43fcb5404e1b2ab8744eb34ab717d71b6d9
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=4
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 468063 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7f3740000c58
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      stack_bottom = 0x7f377c10cd20 thread_stack 0x49000
      addr2line: 'bin/mysqld': No such file
      Printing to addr2line failed
      bin/mysqld(my_print_stacktrace+0x2e)[0x5601900f290e]
      bin/mysqld(handle_fatal_signal+0x2f7)[0x56018fae3cc7]
      sigaction.c:0(__restore_rt)[0x7f37a0a32420]
      addr2line: 'bin/mysqld': No such file
      bin/mysqld(_ZN19Type_std_attributes22agg_item_set_converterERK11DTCollationRK25st_mysql_const_lex_stringPP4ItemjjiPKNS_15Single_coll_errE+0x138)[0x56018fb10298]
      bin/mysqld(_ZN16Item_func_concat18fix_length_and_decEP3THD+0xaa)[0x56018fb89eda]
      bin/mysqld(_ZN9Item_func10fix_fieldsEP3THDPP4Item+0x11f)[0x56018fb54c5f]
      bin/mysqld(_ZN13Item_str_func10fix_fieldsEP3THDPP4Item+0x12)[0x56018fb856a2]
      bin/mysqld(_ZN3THD16sp_fix_func_itemEPP4Item+0x4c)[0x56018f7d7cec]
      bin/mysqld(_ZN3THD31sp_fix_func_item_for_assignmentEPK5FieldPP4Item+0x12)[0x56018f7d7d82]
      bin/mysqld(_ZN5Field25sp_prepare_and_store_itemEP3THDPP4Item+0x18)[0x56018fac3618]
      bin/mysqld(_ZN3THD12sp_eval_exprEP5FieldPP4Item+0x58)[0x56018f7d7e18]
      bin/mysqld(_ZN11sp_rcontext12set_variableEP3THDjPP4Item+0x23)[0x56018f7e4273]
      bin/mysqld(_ZN7sp_head16bind_input_paramEP3THDP4ItemjP11sp_rcontextb+0x6f)[0x56018f7dac4f]
      bin/mysqld(_ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE+0x166)[0x56018f7db116]
      bin/mysqld(+0x87856a)[0x56018f87856a]
      bin/mysqld(_ZN12Sql_cmd_call7executeEP3THD+0x17a)[0x56018f87ad4a]
      bin/mysqld(_Z21mysql_execute_commandP3THDb+0x236d)[0x56018f8833cd]
      bin/mysqld(_ZN13sp_instr_stmt9exec_coreEP3THDPj+0x38)[0x56018fa164c8]
      bin/mysqld(_ZN13sp_lex_keeper23reset_lex_and_exec_coreEP3THDPjbP8sp_instrb+0x178)[0x56018fa18898]
      bin/mysqld(_ZN13sp_lex_keeper26validate_lex_and_exec_coreEP3THDPjbP12sp_lex_instr+0xb0)[0x56018fa194b0]
      bin/mysqld(_ZN13sp_instr_stmt7executeEP3THDPj+0x599)[0x56018fa19d69]
      bin/mysqld(_ZN7sp_head7executeEP3THDb+0xb04)[0x56018f7d99e4]
      bin/mysqld(_ZN7sp_head17execute_procedureEP3THDP4ListI4ItemE+0x54f)[0x56018f7db4ff]
      bin/mysqld(+0x87856a)[0x56018f87856a]
      bin/mysqld(_ZN12Sql_cmd_call7executeEP3THD+0x17a)[0x56018f87ad4a]
      bin/mysqld(_Z21mysql_execute_commandP3THDb+0x236d)[0x56018f8833cd]
      bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x20b)[0x56018f885efb]
      bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjb+0x14b8)[0x56018f888358]
      bin/mysqld(_Z10do_commandP3THDb+0x123)[0x56018f889893]
      bin/mysqld(_Z24do_handle_one_connectionP7CONNECTb+0x187)[0x56018f999387]
      bin/mysqld(handle_one_connection+0x34)[0x56018f999624]
      bin/mysqld(+0xd3756c)[0x56018fd3756c]
      nptl/pthread_create.c:478(start_thread)[0x7f37a0a26609]
      addr2line: DWARF error: section .debug_info is larger than its filesize! (0x93f189 vs 0x531198)
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7f37a0612353]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f37400e46b0): CALL called(CONCAT( NAME_CONST('v',_utf8mb3'' COLLATE 'utf8mb3_general_ci'),'.', NAME_CONST('v',_utf8mb3'' COLLATE 'utf8mb3_general_ci')))
       
      Connection ID (thread ID): 8
      Status: NOT_KILLED
       
      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,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=off,sargable_casefold=on
       
      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /home/pgulutzan/Downloads/mariadb-11.4.0-preview-linux-systemd-x86_64/data
      Resource Limits:
      Limit                     Soft Limit           Hard Limit           Units     
      Max cpu time              unlimited            unlimited            seconds   
      Max file size             unlimited            unlimited            bytes     
      Max data size             unlimited            unlimited            bytes     
      Max stack size            8388608              unlimited            bytes     
      Max core file size        0                    unlimited            bytes     
      Max resident set          unlimited            unlimited            bytes     
      Max processes             18856                18856                processes 
      Max open files            32186                32186                files     
      Max locked memory         67108864             67108864             bytes     
      Max address space         unlimited            unlimited            bytes     
      Max file locks            unlimited            unlimited            locks     
      Max pending signals       18856                18856                signals   
      Max msgqueue size         819200               819200               bytes     
      Max nice priority         0                    0                    
      Max realtime priority     0                    0                    
      Max realtime timeout      unlimited            unlimited            us        
      Core pattern: |/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E
       
      Kernel version: Linux version 5.15.0-107-generic (buildd@lcy02-amd64-017) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #117~20.04.1-Ubuntu SMP Tue Apr 30 10:35:57 UTC 2024
       
      Segmentation fault
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Peter Gulutzan Peter Gulutzan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.