Details
Description
When upgrading to 10.2.15, mysqld got SIGSEGV during mysql_upgrade.
Used commands extracted from mysql_upgrade and it is reproducible in default MariaDB 10.2.15 on Debian 9 with use_stat_tables = preferably and optimizer_use_condition_selectivity = 4
Also observed on 10.3.7 and 10.1.33.
10.2.14 is not affected.
Please see the output:
root@debian9:~# cat /etc/debian_version
9.4
root@debian9:~# cat /etc/apt/sources.list.d/mariadb.10.2.list
deb http://ftp.hosteurope.de/mirror/mariadb.org/repo/10.2/debian stretch main
root@debian9:~# cat /etc/mysql/mariadb.conf.d/bad.cnf
[mysqld]
use_stat_tables = preferably
optimizer_use_condition_selectivity = 4
root@debian9:~# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.2.15-MariaDB-10.2.15+maria~stretch-log mariadb.org binary distribution
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 test;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> use test;
Database changed
MariaDB [test]> CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(80) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> set @had_proxies_priv_table= @@warning_count != 0;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> CREATE TEMPORARY TABLE tmp_proxies_priv LIKE proxies_priv;
Query OK, 0 rows affected (0.00 sec)
MariaDB [test]> INSERT INTO tmp_proxies_priv VALUES ('localhost', 'root', '', '', TRUE, '', now());
Query OK, 1 row affected (0.00 sec)
MariaDB [test]> INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Excerpt from syslog:
Jun 18 09:42:13 debian9 mysqld[6596]: 180618 9:42:13 [ERROR] mysqld got signal 11 ;
Jun 18 09:42:13 debian9 mysqld[6596]: This could be because you hit a bug. It is also possible that this binary
Jun 18 09:42:13 debian9 mysqld[6596]: or one of the libraries it was linked against is corrupt, improperly built,
Jun 18 09:42:13 debian9 mysqld[6596]: or misconfigured. This error can also be caused by malfunctioning hardware.
Jun 18 09:42:13 debian9 mysqld[6596]: To report this bug, see https://mariadb.com/kb/en/reporting-bugs
Jun 18 09:42:13 debian9 mysqld[6596]: We will try our best to scrape up some info that will hopefully help
Jun 18 09:42:13 debian9 mysqld[6596]: diagnose the problem, but since we have already crashed,
Jun 18 09:42:13 debian9 mysqld[6596]: something is definitely wrong and this may fail.
Jun 18 09:42:13 debian9 mysqld[6596]: Server version: 10.2.15-MariaDB-10.2.15+maria~stretch-log
Jun 18 09:42:13 debian9 mysqld[6596]: key_buffer_size=134217728
Jun 18 09:42:13 debian9 mysqld[6596]: read_buffer_size=2097152
Jun 18 09:42:13 debian9 mysqld[6596]: max_used_connections=1
Jun 18 09:42:13 debian9 mysqld[6596]: max_threads=102
Jun 18 09:42:13 debian9 mysqld[6596]: thread_count=8
Jun 18 09:42:13 debian9 mysqld[6596]: It is possible that mysqld could use up to
Jun 18 09:42:13 debian9 mysqld[6596]: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 759911 K bytes of memory
Jun 18 09:42:13 debian9 mysqld[6596]: Hope that's ok; if not, decrease some variables in the equation.
Jun 18 09:42:13 debian9 mysqld[6596]: Thread pointer: 0x55a128ab66f8
Jun 18 09:42:13 debian9 mysqld[6596]: Attempting backtrace. You can use the following information to find out
Jun 18 09:42:13 debian9 mysqld[6596]: where mysqld died. If you see no messages after this, something went
Jun 18 09:42:13 debian9 mysqld[6596]: terribly wrong...
Jun 18 09:42:13 debian9 mysqld[6596]: stack_bottom = 0x7f76802e6cf8 thread_stack 0x49000
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55a1251c7dfe]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(handle_fatal_signal+0x41d)[0x55a124c6adad]
Jun 18 09:42:13 debian9 mysqld[6596]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x110c0)[0x7f768aba10c0]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z36read_statistics_for_tables_if_neededP3THDP10TABLE_LIST+0x969)[0x55a124b47d99]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z20open_and_lock_tablesP3THDRK14DDL_options_stP10TABLE_LISTbjP19Prelocking_strategy+0x9d)[0x55a124a8dafd]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x3702)[0x55a124ad3fe2]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x28a)[0x55a124ad98ca]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x215f)[0x55a124adc8bf]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z10do_commandP3THD+0x176)[0x55a124add226]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x25a)[0x55a124ba26ba]
Jun 18 09:42:13 debian9 mysqld[6596]: /usr/sbin/mysqld(handle_one_connection+0x3d)[0x55a124ba282d]
Jun 18 09:42:13 debian9 mysqld[6596]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x7494)[0x7f768ab97494]
Jun 18 09:42:13 debian9 mysqld[6596]: /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f76890f1acf]
Jun 18 09:42:13 debian9 mysqld[6596]: Trying to get some variables.
Jun 18 09:42:13 debian9 mysqld[6596]: Some pointers may be invalid and cause the dump to abort.
Jun 18 09:42:13 debian9 mysqld[6596]: Query (0x55a128b43d70): INSERT INTO proxies_priv SELECT * FROM tmp_proxies_priv WHERE @had_proxies_priv_table=0
Jun 18 09:42:13 debian9 mysqld[6596]: Connection ID (thread ID): 10
Jun 18 09:42:13 debian9 mysqld[6596]: Status: NOT_KILLED
Jun 18 09:42:13 debian9 mysqld[6596]: 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=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
Jun 18 09:42:13 debian9 mysqld[6596]: The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
Jun 18 09:42:13 debian9 mysqld[6596]: information that should help you find out what is causing the crash.
Jun 18 09:42:13 debian9 systemd[1]: mariadb.service: Main process exited, code=killed, status=11/SEGV
Attachments
Issue Links
- duplicates
-
MDEV-16068 [Draft] Server crashed in alloc_histograms_for_table_share
- Closed
- relates to
-
MDEV-19079 Server crash on read_statistics_for_tables_if_needed
- Closed
Thanks for the report and test case!
Reproducible on MariaDB 10.0-10.3
Version: '10.0.36-MariaDB-debug' socket: '/home/alice/git/10.0/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
safe_mutex: Trying to lock unitialized mutex at /home/alice/git/10.0/sql/sql_statistics.cc, line 2252
180618 13:11:22 [ERROR] mysqld got signal 6 ;
Server version: 10.0.36-MariaDB-debug
Thread pointer: 0x62a00005a208
stack_bottom = 0x7fcf0a140e20 thread_stack 0x48000
/usr/lib/x86_64-linux-gnu/libasan.so.2(+0x4a077)[0x7fcf135fb077]
include/mach0data.ic:271(mach_read_compressed)[0x17ff60b]
sql/debug_sync.cc:655(debug_sync_get_action)[0xb000f5]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fcf12b4d390]
linux/raise.c:54(__GI_raise)[0x7fcf1211c428]
stdlib/abort.c:91(__GI_abort)[0x7fcf1211e02a]
include/rem0rec.ic:909(rec_offs_get_n_alloc)[0x180adee]
/home/alice/git/10.0/sql/mysqld(_Z36read_statistics_for_tables_if_neededP3THDP10TABLE_LIST+0x331f)[0x82532e]
/home/alice/git/10.0/sql/mysqld(_Z20open_and_lock_tablesP3THDP10TABLE_LISTbjP19Prelocking_strategy+0x245)[0x5f3dd4]
/home/alice/git/10.0/sql/mysqld(_Z21mysql_execute_commandP3THD+0xaaf1)[0x6be7c3]
/home/alice/git/10.0/sql/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x4d6)[0x6cb5d9]
/home/alice/git/10.0/sql/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1fe9)[0x6cec65]
/home/alice/git/10.0/sql/mysqld(_Z10do_commandP3THD+0x919)[0x6d3495]
sql/item.h:1401(Item::check_vcol_func_processor(unsigned char*))[0x948aa4]
sql/item.h:1696(Item_basic_value::is_basic_value(Item::Type) const)[0x948d13]
include/sync0sync.ic:146(mutex_get_waiters)[0x173bb94]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fcf12b436ba]
x86_64/clone.S:111(clone)[0x7fcf121ee41d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x610000008360): INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0
Connection ID (thread ID): 3
Status: NOT_KILLED
10.1.34-MariaDB-debug 9f848da640dd6c3f44d
Thread 1 (Thread 0x7f8f64183b00 (LWP 21336)):
#0 __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1 0x0000560e35c6dfdb in my_write_core (sig=6) at /home/alice/git/10.1/mysys/stacktrace.c:477
#2 0x0000560e355b05f3 in handle_fatal_signal (sig=6) at /home/alice/git/10.1/sql/signal_handler.cc:296
#3 <signal handler called>
#4 0x00007f8f69715428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5 0x00007f8f6971702a in __GI_abort () at abort.c:89
#6 0x0000560e35c7348b in safe_mutex_lock (mp=0x7f8f4816c500, my_flags=0, file=0x560e35d865c0 "/home/alice/git/10.1/sql/sql_statistics.cc", line=2394) at /home/alice/git/10.1/mysys/thr_mutex.c:247
#7 0x0000560e3540d107 in inline_mysql_mutex_lock (that=0x7f8f4816c500, src_file=0x560e35d865c0 "/home/alice/git/10.1/sql/sql_statistics.cc", src_line=2394) at /home/alice/git/10.1/include/mysql/psi/mysql_thread.h:689
#8 0x0000560e3540e58a in alloc_histograms_for_table_share (thd=0x560e3920c548, table_share=0x7f8f4816c360, is_safe=false) at /home/alice/git/10.1/sql/sql_statistics.cc:2394
#9 0x0000560e3540fcf2 in read_histograms_for_table (thd=0x560e3920c548, table=0x7f8f4816b7b8, stat_tables=0x7f8f64180750) at /home/alice/git/10.1/sql/sql_statistics.cc:3167
#10 0x0000560e354100ff in read_statistics_for_tables_if_needed (thd=0x560e3920c548, tables=0x7f8f48171620) at /home/alice/git/10.1/sql/sql_statistics.cc:3250
#11 0x0000560e352ffcf0 in open_and_lock_tables (thd=0x560e3920c548, options=..., tables=0x7f8f48171620, derived=true, flags=0, prelocking_strategy=0x7f8f64181a20) at /home/alice/git/10.1/sql/sql_base.cc:5294
#12 0x0000560e352f3318 in open_and_lock_tables (thd=0x560e3920c548, tables=0x7f8f48171620, derived=true, flags=0) at /home/alice/git/10.1/sql/sql_base.h:541
#13 0x0000560e35368997 in mysql_execute_command (thd=0x560e3920c548) at /home/alice/git/10.1/sql/sql_parse.cc:4008
#14 0x0000560e35373477 in mysql_parse (thd=0x560e3920c548, rawbuf=0x7f8f4805c820 "INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0", length=57, parser_state=0x7f8f64182610) at /home/alice/git/10.1/sql/sql_parse.cc:7449
#15 0x0000560e35361b84 in dispatch_command (command=COM_QUERY, thd=0x560e3920c548, packet=0x560e39212029 "INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0", packet_length=57) at /home/alice/git/10.1/sql/sql_parse.cc:1492
#16 0x0000560e35360902 in do_command (thd=0x560e3920c548) at /home/alice/git/10.1/sql/sql_parse.cc:1121
#17 0x0000560e354a070b in do_handle_one_connection (thd_arg=0x560e3920c548) at /home/alice/git/10.1/sql/sql_connect.cc:1330
#18 0x0000560e354a045a in handle_one_connection (arg=0x560e3920c548) at /home/alice/git/10.1/sql/sql_connect.cc:1242
#19 0x0000560e35bff9e8 in pfs_spawn_thread (arg=0x560e3913d848) at /home/alice/git/10.1/storage/perfschema/pfs.cc:1861
#20 0x00007f8f6a13c6ba in start_thread (arg=0x7f8f64183b00) at pthread_create.c:333
#21 0x00007f8f697e741d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
on not-debug version: (10.3)
Thread 1 (Thread 0x7fee749c5700 (LWP 8794)):
#0 __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1 0x00005582acd0dfea in my_write_core (sig=sig@entry=11) at /home/alice/git/10.3/mysys/stacktrace.c:481
#2 0x00005582ac85d674 in handle_fatal_signal (sig=11) at /home/alice/git/10.3/sql/signal_handler.cc:305
#3 <signal handler called>
#4 alloc_histograms_for_table_share (is_safe=false, thd=<optimized out>, table_share=0x7fee64074b88) at /home/alice/git/10.3/sql/sql_statistics.cc:2408
#5 read_histograms_for_table (stat_tables=0x7fee749c0f80, table=0x7fee64067258, thd=0x7fee640009a8) at /home/alice/git/10.3/sql/sql_statistics.cc:3171
#6 read_statistics_for_tables_if_needed (thd=thd@entry=0x7fee640009a8, tables=<optimized out>) at /home/alice/git/10.3/sql/sql_statistics.cc:3254
#7 0x00005582ac64e2d6 in open_and_lock_tables (thd=thd@entry=0x7fee640009a8, options=..., tables=0x7fee640117a0, derived=derived@entry=true, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7fee749c3060) at /home/alice/git/10.3/sql/sql_base.cc:4949
#8 0x00005582ac6a0b18 in open_and_lock_tables (flags=0, derived=true, tables=<optimized out>, thd=0x7fee640009a8) at /home/alice/git/10.3/sql/sql_base.h:497
#9 mysql_execute_command (thd=thd@entry=0x7fee640009a8) at /home/alice/git/10.3/sql/sql_parse.cc:4800
#10 0x00005582ac6a7b89 in mysql_parse (thd=thd@entry=0x7fee640009a8, rawbuf=<optimized out>, length=57, parser_state=parser_state@entry=0x7fee749c4630, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /home/alice/git/10.3/sql/sql_parse.cc:8076
#11 0x00005582ac6aa349 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7fee640009a8, packet=packet@entry=0x7fee64009319 "INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0", packet_length=packet_length@entry=57, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /home/alice/git/10.3/sql/sql_parse.cc:1847
#12 0x00005582ac6aadc0 in do_command (thd=0x7fee640009a8) at /home/alice/git/10.3/sql/sql_parse.cc:1392
#13 0x00005582ac76c2c4 in do_handle_one_connection (connect=connect@entry=0x5582ae8ce5c8) at /home/alice/git/10.3/sql/sql_connect.cc:1402
#14 0x00005582ac76c444 in handle_one_connection (arg=arg@entry=0x5582ae8ce5c8) at /home/alice/git/10.3/sql/sql_connect.cc:1308
#15 0x00005582acccc094 in pfs_spawn_thread (arg=0x5582ae890ed8) at /home/alice/git/10.3/storage/perfschema/pfs.cc:1862
#16 0x00007fee7b4666ba in start_thread (arg=0x7fee749c5700) at pthread_create.c:333
#17 0x00007fee7a8fb41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109