[MDEV-17144] Sample of spider_direct_sql cause crash Created: 2018-09-06  Updated: 2019-04-30  Resolved: 2018-09-18

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.3.9
Fix Version/s: 10.3.10, 10.4.0

Type: Bug Priority: Critical
Reporter: Anders Karlsson Assignee: Jacob Mathew (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

CentOS 7.4


Issue Links:
Duplicate
is duplicated by MDEV-17405 spider_bg_direct_sql caused instance ... Closed

 Description   

When running the sample code on page:https://mariadb.com/kb/en/library/spider-cluster-management/ . It seems that spider_direct_sql mostly cause a crash.

MariaDB [mysql]> CREATE TEMPORARY TABLE res (   id int(10) unsigned NOT NULL,   k int(10) unsigned NOT NULL DEFAULT '0',   c char(120) NOT NULL DEFAULT '',   pad char(60) NOT NULL DEFAULT '' ) ENGINE=MEMORY;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [mysql]> SELECT spider_direct_sql( 'SELECT * FROM sbtest s  WHERE s.id IN(10,12,13)',   'res',   concat('host "', host, '", port "', port, '", user "', username, '", password "', password, '", database "', tgt_db_name, '"') ) a FROM   mysql.spider_tables WHERE   db_name = 'backend' and table_name like 'sbtest#P#pt%';
ERROR 2013 (HY000): Lost connection to MySQL server during query

Stack dump looks like this:
180906 11:02:21 [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.3.9-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=27
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467396 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f2f38928408
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 = 0x7f2f14240d70 thread_stack 0x49000
mysys/stacktrace.c:270(my_print_stacktrace)[0x7f2f3531466e]
sql/signal_handler.cc:168(handle_fatal_signal)[0x7f2f34da4f37]
sigaction.c:0(__restore_rt)[0x7f2f341f4100]
:0(__strnlen_sse2)[0x7f2f327d2ec1]
include/m_ctype.h:1096(my_well_formed_length)[0x7f2f3535ce29]
strings/my_vsnprintf.c:627(my_vsnprintf_ex)[0x7f2f3535db3f]
mysys/my_error.c:154(my_printf_error)[0x7f2f3530b0b9]
spider/spd_direct_sql.cc:1709(spider_direct_sql_body(st_udf_init*, st_udf_args*, char*, char*, char))[0x7f2f2739b1b9]
sql/sql_udf.h:108(udf_handler::val_int(char*))[0x7f2f34e194de]
sql/sql_type.cc:5314(Type_handler::Item_send_longlong(Item*, Protocol*, st_value*) const)[0x7f2f34d01cb9]
sql/protocol.cc:986(Protocol::send_result_set_row(List<Item>*))[0x7f2f34b23aaf]
sql/sql_class.cc:2932(select_send::send_data(List<Item>&))[0x7f2f34b8ffe3]
sql/sql_select.cc:20463(end_send)[0x7f2f34c1903f]
sql/sql_class.h:3868(THD::get_stmt_da())[0x7f2f34bfda1c]
sql/sql_select.cc:19291(sub_select(JOIN*, st_join_table*, bool))[0x7f2f34c0769e]
sql/sql_select.cc:18824(do_select)[0x7f2f34c28d42]
sql/sql_select.cc:3823(JOIN::exec())[0x7f2f34c28f93]
sql/sql_select.cc:4229(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x7f2f34c290ea]
sql/sql_select.cc:382(handle_select(THD*, LEX*, select_result*, unsigned long))[0x7f2f34c29bfc]
sql/sql_parse.cc:6547(execute_sqlcom_select)[0x7f2f34adf19f]
sql/sql_parse.cc:3768(mysql_execute_command(THD*))[0x7f2f34bd5fbd]
sql/sql_parse.cc:8089(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x7f2f34bd87cb]
sql/sql_parse.cc:1850(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x7f2f34bdb315]
sql/sql_parse.cc:1397(do_command(THD*))[0x7f2f34bdc17e]
sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x7f2f34cac50a]
sql/sql_connect.cc:1310(handle_one_connection)[0x7f2f34cac62d]
pthread_create.c:0(start_thread)[0x7f2f341ecdc5]
/lib64/libc.so.6(clone+0x6d)[0x7f2f32842ced]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f2f38937e10): SELECT spider_direct_sql( 'SELECT * FROM sbtest s WHERE s.id IN(10,12,13)', 'res', concat('host "', host, '", port "', port, '", user "', username, '", password "', password, '", database "', tgt_db_name, '"') ) a FROM mysql.spider_tables WHERE db_name = 'backend' and table_name like 'sbtest#P#pt%'
Connection ID (thread ID): 28
Status: NOT_KILLED



 Comments   
Comment by Jacob Mathew (Inactive) [ 2018-09-18 ]

Kentoku, please review my fix for this problem in commit e339616 on my branch.

Comment by Kentoku Shiba (Inactive) [ 2018-09-18 ]

It's OK to push.

Comment by Jacob Mathew (Inactive) [ 2018-09-18 ]

Fix is pushed to 10.3 and 10.4.

Comment by Jacob Mathew (Inactive) [ 2018-09-18 ]

I have fixed the reported crash. If you encounter further problems with Spider direct SQL or its documentation, please open new bugs for those problems.

Generated at Thu Feb 08 08:34:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.