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

Segmentation fault after failed CREATE followed by DROP

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.7.3
    • Fix Version/s: 10.7.4, 10.8.3
    • Component/s: Parser
    • Labels:
      None
    • Environment:
      Ubuntu 20.04, 64-bit

      Description

      I don't know the earliest minor version number, but I know this did not happen with MariaDB 10.6.7.
      (In fact the CREATE PROCEDURE statement, which now fails, used to work, but that's not the main issue here.)
      It is possible that it happens only for schema-change statements on the non-default schema (database).
      As root, immediately after install, I say:
      CREATE DATABASE a;
      CREATE DATABASE b;
      USE a
      CREATE PROCEDURE b.b() SET @=@a;
      DROP PROCEDURE b.b;
      Result = Segmentation fault on the server.

      I think that's all you'll need to reproduce.
      However, I'll give exact details in what follows, in case you think there's something odd about my setup.

      downloaded MariaDB 10.7.3 from https://mariadb.org/download/?t=mariadb&p=mariadb&r=10.7.3&os=Linux&cpu=x86_64&i=systemd&m=xtom_fre
      (Linux, x86_64, systemd, 2022-02-14)

      On a shell (terminal #1), say:
      export MARIADB=mariadb-10.7.3-linux-systemd-x86_64
      mv $HOME/Downloads/$MARIADB.tar.gz $HOME/$MARIADB.tar.gz
      cd $HOME
      tar -xf $MARIADB.tar.gz
      cd $MARIADB
      #See https://mariadb.com/kb/en/mysql_install_db/
      sudo scripts/mysql_install_db --basedir=$HOME/$MARIADB --datadir=$HOME/$MARIADB/data --user=root
      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

      export MARIADB=mariadb-10.7.3-linux-systemd-x86_64
      cd $HOME/$MARIADB
      sudo bin/mysql

      CREATE DATABASE a;
      CREATE DATABASE b;
      USE a
      CREATE PROCEDURE b.b() SET @=@a;
      DROP PROCEDURE b.b;

      Now Terminal #2 looks like this:
      pgulutzan@pgulutzan-VirtualBox:~/mariadb-10.7.3-linux-systemd-x86_64$ sudo bin/mysql
      [sudo] password for pgulutzan:
      Welcome to the MariaDB monitor. Commands end with ; or \g.
      Your MariaDB connection id is 3
      Server version: 10.7.3-MariaDB MariaDB Server

      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 [(none)]> CREATE DATABASE a;
      Query OK, 1 row affected (0.000 sec)

      MariaDB [(none)]> CREATE DATABASE b;
      Query OK, 1 row affected (0.000 sec)

      MariaDB [(none)]> USE a
      Database changed
      MariaDB [a]> DROP PROCEDURE b.b;
      ERROR 1305 (42000): PROCEDURE b.b does not exist
      MariaDB [a]> CREATE PROCEDURE b.b() SET @=@a;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=@a' at line 1
      MariaDB [a]> DROP PROCEDURE b.b;
      ERROR 2013 (HY000): Lost connection to server during query
      MariaDB [a]>

      And now Terminal #1 looks like this:

      pgulutzan@pgulutzan-VirtualBox:~/mariadb-10.7.3-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
      2022-05-16 18:10:09 0 [Note] bin/mysqld (server 10.7.3-MariaDB) starting as process 55856 ...
      2022-05-16 18:10:09 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
      2022-05-16 18:10:09 0 [Note] InnoDB: Number of transaction pools: 1
      2022-05-16 18:10:09 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2022-05-16 18:10:09 0 [Note] InnoDB: Using Linux native AIO
      2022-05-16 18:10:09 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
      2022-05-16 18:10:09 0 [Note] InnoDB: Completed initialization of buffer pool
      2022-05-16 18:10:09 0 [Note] InnoDB: 128 rollback segments are active.
      2022-05-16 18:10:09 0 [Note] InnoDB: Creating shared tablespace for temporary tables
      2022-05-16 18:10:09 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
      2022-05-16 18:10:09 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
      2022-05-16 18:10:09 0 [Note] InnoDB: 10.7.3 started; log sequence number 42173; transaction id 14
      2022-05-16 18:10:09 0 [Note] Plugin 'FEEDBACK' is disabled.
      2022-05-16 18:10:09 0 [Note] InnoDB: Loading buffer pool(s) from /home/pgulutzan/mariadb-10.7.3-linux-systemd-x86_64/data/ib_buffer_pool
      2022-05-16 18:10:09 0 [Note] Server socket created on IP: '0.0.0.0'.
      2022-05-16 18:10:09 0 [Note] Server socket created on IP: '::'.
      2022-05-16 18:10:09 0 [Note] InnoDB: Buffer pool(s) load completed at 220516 18:10:09
      2022-05-16 18:10:09 0 [Note] bin/mysqld: ready for connections.
      Version: '10.7.3-MariaDB' socket: '/tmp/mysql.sock' port: 3306 MariaDB Server
      220516 18:13:06 [ERROR] mysqld got signal 11 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.

      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: 10.7.3-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=1
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467994 K bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.

      Thread pointer: 0x7f2e78000f58
      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 = 0x7f2eac8eed60 thread_stack 0x49000
      bin/mysqld(my_print_stacktrace+0x2e)[0x562ed7e5284e]
      addr2line: 'bin/mysqld': No such file
      bin/mysqld(handle_fatal_signal+0x307)[0x562ed782e547]
      sigaction.c:0(__restore_rt)[0x7f2eb6e6f3c0]
      addr2line: 'bin/mysqld': No such file
      Printing to addr2line failed
      bin/mysqld(_ZN7sp_head20restore_thd_mem_rootEP3THD+0x10)[0x562ed7559f60]
      bin/mysqld(_ZN3LEX29cleanup_lex_after_parse_errorEP3THD+0x4a)[0x562ed75d48ea]
      bin/mysqld(_Z10MYSQLparseP3THD+0xc848)[0x562ed77bd1a8]
      bin/mysqld(_Z9parse_sqlP3THDP12Parser_stateP19Object_creation_ctxb+0x13d)[0x562ed760031d]
      bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0xf6)[0x562ed7600576]
      bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjb+0x1217)[0x562ed76028d7]
      bin/mysqld(_Z10do_commandP3THDb+0x123)[0x562ed7603f73]
      bin/mysqld(_Z24do_handle_one_connectionP7CONNECTb+0x187)[0x562ed7706ec7]
      bin/mysqld(handle_one_connection+0x34)[0x562ed7707164]
      bin/mysqld(+0xc7cc4c)[0x562ed7a7cc4c]
      nptl/pthread_create.c:478(start_thread)[0x7f2eb6e63609]
      ??:0(clone)[0x7f2eb6a4f163]

      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f2e7802b960): DROP PRO��

      Connection ID (thread ID): 3
      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,engine_condition_pushdown=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

      The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
      information that should help you find out what is causing the crash.
      Writing a core file...
      Working directory at /home/pgulutzan/mariadb-10.7.3-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 18968 18968 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 18968 18968 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 %s %c %d %P %E

      Segmentation fault

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shulga Dmitry Shulga
              Reporter:
              Peter Gulutzan Peter Gulutzan
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.