Bug #107108 mysqlpump crash when dump data
Submitted: 24 Apr 8:09 Modified: 24 Apr 9:11
Reporter: ting du Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqlpump Command-line Client Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[24 Apr 8:09] ting du
Description:
mysqlpump crash when dump data.

log:
mysqlpump: [Warning] Using a password on the command line interface can be insecure.
Dump progress: 1/1 tables, 0/0 rows
Dump progress: 8/83 tables, 45416/11134941 rows
Dump progress: 8/96 tables, 156416/12034941 rows
Dump progress: 10/160 tables, 222666/12049914 rows
Dump progress: 10/160 tables, 341666/12049914 rows
Dump progress: 11/223 tables, 412666/12516010 rows
Dump progress: 12/265 tables, 525416/12715050 rows
Dump progress: 13/305 tables, 612416/14918130 rows
Dump progress: 14/305 tables, 690916/14918130 rows
Dump progress: 15/395 tables, 804916/22622835 rows
mysqlpump: [ERROR] (1049) Unknown database 'db4173'
Dump process encountered error and will not continue.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
mysqlpump.sh: line 33: 13184 Aborted                 (core dumped) ${binary} -h$dbhost -P$dbport -u$dbuser -p$dbpwd --set-gtid-purged=off -A ${extra} > ${backpath}/${binary}_${dbhost}_${dbport}.sql

core:
(gdb) bt
#0  0x00002af929c8d597 in raise () from /lib64/libc.so.6
#1  0x00002af929c8ec88 in abort () from /lib64/libc.so.6
#2  0x00002af9294979d5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6
#3  0x00002af929495946 in ?? () from /lib64/libstdc++.so.6
#4  0x00002af929495973 in std::terminate() () from /lib64/libstdc++.so.6
#5  0x00002af929495b93 in __cxa_throw () from /lib64/libstdc++.so.6
#6  0x00002af92949612d in operator new(unsigned long) () from /lib64/libstdc++.so.6
#7  0x00002af9294f4c69 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) () from /lib64/libstdc++.so.6
#8  0x00002af9294f58ab in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) () from /lib64/libstdc++.so.6
#9  0x00002af9294f5f7c in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /lib64/libstdc++.so.6
#10 0x0000000000548986 in Mysql::Tools::Dump::Abstract_data_object::get_name (this=<optimized out>) at ../../../client/dump/abstract_data_object.cc:38
#11 0x000000000053b7c9 in Mysql::Tools::Dump::Sql_formatter::format_row_group(Mysql::Tools::Dump::Row_group_dump_task*) ()
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/basic_string.h:3901
#12 0x0000000000540418 in try_process_task<Mysql::Tools::Dump::Row_group_dump_task, Mysql::Tools::Dump::Sql_formatter> (processing_func=
    (void (Mysql::Tools::Dump::Sql_formatter::*)(Mysql::Tools::Dump::Sql_formatter * const, Mysql::Tools::Dump::Row_group_dump_task *)) 0x53b5b0 <Mysql::Tools::Dump::Sql_formatter::format_row_group(Mysql::Tools::Dump::Row_group_dump_task*)>, item_to_process=0x2015f10, this=0x1fd9e60) at ../../../client/dump/abstract_chain_element.h:75
#13 Mysql::Tools::Dump::Sql_formatter::format_object (this=0x1fd9e60, item_to_process=0x2015f10) at ../../../client/dump/sql_formatter.cc:444
#14 0x0000000000552cfa in Mysql::Tools::Dump::Abstract_data_formatter_wrapper::format_object (this=this@entry=0x1fd9fd0, current_processing_data=0x2015ed0)
    at ../../../client/dump/abstract_data_formatter_wrapper.cc:35
#15 0x00000000005525f5 in format_rows (row_group=0x2005e60, item_to_process=<optimized out>, this=0x1fd9fd0) at ../../../client/dump/mysql_object_reader.cc:139
#16 process_buffer (this=0x2005e50) at ../../../client/dump/mysql_object_reader.cc:44
#17 process_buffer (this=0x2005e50) at ../../../client/dump/mysql_object_reader.cc:40
#18 Mysql::Tools::Dump::Mysql_object_reader::Rows_fetching_context::result_callback(Mysql::Tools::Base::Mysql_query_runner::Row const&) () at ../../../client/dump/mysql_object_reader.cc:61
#19 0x0000000000560037 in Mysql::Tools::Base::Mysql_query_runner::run_query_unguarded(std::string) [clone .localalias] () at ../../../client/base/mysql_query_runner.cc:165
#20 0x000000000056053b in Mysql::Tools::Base::Mysql_query_runner::run_query(std::string) [clone .localalias] () at ../../../client/base/mysql_query_runner.cc:125
#21 0x00000000005606d7 in Mysql::Tools::Base::Mysql_query_runner::run_query(std::string, Mysql::I_callable<long long, Mysql::Tools::Base::Mysql_query_runner::Row const&>*) [clone .localalias] () at ../../../client/base/mysql_query_runner.cc:104
#22 0x000000000054ff82 in Mysql::Tools::Dump::Mysql_object_reader::read_table_rows_task(Mysql::Tools::Dump::Table_rows_dump_task*, Mysql::Tools::Dump::Item_processing_data*) ()
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/basic_string.h:6020
#23 0x0000000000551188 in try_process_task<Mysql::Tools::Dump::Table_rows_dump_task, Mysql::Tools::Dump::Mysql_object_reader> (processing_func=
    (void (Mysql::Tools::Dump::Mysql_object_reader::*)(Mysql::Tools::Dump::Mysql_object_reader * const, Mysql::Tools::Dump::Table_rows_dump_task *, Mysql::Tools::Dump::Item_processing_data *)) 0x54f560 <Mysql::Tools::Dump::Mysql_object_reader::read_table_rows_task(Mysql::Tools::Dump::Table_rows_dump_task*, Mysql::Tools::Dump::Item_processing_data*)>, 
    item_to_process=0x1ffed10, this=0x1fd9fd8) at ../../../client/dump/abstract_chain_element.h:60
#24 Mysql::Tools::Dump::Mysql_object_reader::read_object (this=0x1fd9fd0, item_to_process=0x1ffed10) at ../../../client/dump/mysql_object_reader.cc:148
#25 0x000000000054af5a in Mysql::Tools::Dump::Abstract_object_reader_wrapper::format_object (this=this@entry=0x1fe6480, 
    current_processing_data=current_processing_data@entry=0x2af92c009fb0) at ../../../client/dump/abstract_object_reader_wrapper.cc:35
#26 0x0000000000534bc7 in Mysql::Tools::Dump::Object_queue::queue_thread (this=0x1fe6480) at ../../../client/dump/object_queue.cc:84
#27 0x0000000000534882 in operator() (p=<optimized out>, this=0x1fd9c90) at ../../../extra/boost_1_59_0/boost/bind/mem_fn_template.hpp:47
#28 operator()<boost::_mfi::mf0<void, Mysql::Tools::Dump::Object_queue>, boost::_bi::list0> (a=<synthetic pointer>, f=..., this=0x1fd9ca0)
    at ../../../extra/boost_1_59_0/boost/bind/bind.hpp:255
#29 operator() (this=0x1fd9c90) at ../../../extra/boost_1_59_0/boost/bind/bind_template.hpp:20
#30 my_boost::thread::context<boost::_bi::bind_t<void, boost::_mfi::mf0<void, Mysql::Tools::Dump::Object_queue>, boost::_bi::list1<boost::_bi::value<Mysql::Tools::Dump::Object_queue*> > > >::entry_point (context_raw=0x1fd9c90) at ../../../client/dump/thread.h:62
#31 0x00002af928e16dc5 in start_thread () from /lib64/libpthread.so.0
#32 0x00002af929d4e81d in clone () from /lib64/libc.so.6

How to repeat:
1. prepare data:
for((i=1;i<=100000;i++))
do
    timeout 30 mysql -u$dbuser -p$dbpasswd -h$dbhost -P$dbport -e "create database db$i; insert into mysql.rds_comment(object_type, object_name, comment) values('DB', \"db$i\", repeat('dd3f@#Dsdadfbc', 150))  on duplicate key update comment = '234daf 是的安抚comment' ; select sleep(1); drop database db$i; select * from mysql.rds_comment where object_name=\"db$i\"" > rds_comment.log 2>&1  
    sleep 1
done

2.use mysqlpump dump data
mysqlpump -h192.107.57.204 -P3306 -uroot -p* ******* --set-gtid-purged=off -A
[24 Apr 9:11] ting du
The reproduction procedure is incorrect.