Bug #83145 mysqlpump crashes and core drops when connection has failed

Submitted: 26 Sep 2016 7:26 Modified: 26 Sep 2016 7:48
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqlpump Command-line Client Severity:S3 (Non-critical)
Version:5.7.15, 8.0.0 OS:CentOS (6.8)
Assigned to: CPU Architecture:Any

[26 Sep 2016 7:26] Tsubasa Tanaka
Description:
mysqlpump crashes when mysqlpump fails to connect MySQL Server.

Because of client/dump/abstract_connection_provider.cc:44 and client/dump/program.cc:160 doesn't validate the mysql connection object was set or not.

How to repeat:
$ client/mysqlpump -S /usr/mysql/8.0.0/data/mysql.sock -uinvalid
mysqlpump: Got error: 1045: Access denied for user 'invalid'@'localhost' (using password: NO) while connecting to the MySQL server
mysqlpump: [ERROR] (11)
Dump process encountered error and will not continue.
Segmentation fault (core dumped)

(gdb) bt
+bt
#0  mysql_send_query (mysql=0x0, query=Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/sql-common/client.cc:5268
#1  0x00000000004c1c51 in mysql_real_query (mysql=0x0, query=Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/sql-common/client.cc:5286
#2  0x00000000004acfb3 in Mysql::Tools::Base::Mysql_query_runner::run_query_unguarded (this=0x234fc70, query=
Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/client/base/mysql_query_runner.cc:126
#3  0x00000000004ad597 in Mysql::Tools::Base::Mysql_query_runner::run_query (this=0x234fc70, query=
Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/client/base/mysql_query_runner.cc:118
#4  0x0000000000493cf6 in Mysql::Tools::Dump::Thread_specific_connection_provider::get_runner (this=0x234f820,
    message_handler=Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/client/dump/thread_specific_connection_provider.cc:31
#5  0x0000000000469268 in Mysql::Tools::Dump::Program::execute (this=0x9edce0,
    positional_options=std::vector of length 0, capacity 0) at /home/yoku0825/mysql-8.0.0-labs-opt/client/dump/program.cc:161
#6  0x00000000004aac74 in Mysql::Tools::Base::Abstract_program::run (this=0x9edce0, argc=0, argv=0x2347420)
    at /home/yoku0825/mysql-8.0.0-labs-opt/client/base/abstract_program.cc:98
#7  0x0000000000467855 in main (argc=Unhandled dwarf expression opcode 0xf3
) at /home/yoku0825/mysql-8.0.0-labs-opt/client/dump/program.cc:278

Suggested fix:
Don't crash, exit with error correctly.
[26 Sep 2016 7:48] MySQL Verification Team
Hello Tanaka-San,

Thank you for the report.

Thanks,
Umesh
[26 Sep 2016 7:49] MySQL Verification Team
-- 5.7.15

(gdb) bt
#0  mysql_send_query (mysql=0x0, query=0x2866428 "SET SQL_QUOTE_SHOW_CREATE= 1", length=28) at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/sql-common/client.c:5211
#1  0x0000000000467881 in mysql_real_query (mysql=0x0, query=<optimized out>, length=<optimized out>)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/sql-common/client.c:5229
#2  0x00000000004557e3 in Mysql::Tools::Base::Mysql_query_runner::run_query_unguarded (this=0x2866880, query=...)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/base/mysql_query_runner.cc:126
#3  0x0000000000455daf in Mysql::Tools::Base::Mysql_query_runner::run_query (this=0x2866880, query=...)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/base/mysql_query_runner.cc:118
#4  0x000000000043b6eb in Mysql::Tools::Dump::Thread_specific_connection_provider::get_runner (this=0x2865e50, message_handler=<optimized out>)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/dump/thread_specific_connection_provider.cc:31
#5  0x000000000041a7fe in Mysql::Tools::Dump::Program::execute (this=0xb878c0 <program>, positional_options=std::vector of length 0, capacity 0)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/dump/program.cc:161
#6  0x0000000000453bf4 in Mysql::Tools::Base::Abstract_program::run (this=0xb878c0 <program>, argc=0, argv=0x2866298)
    at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/base/abstract_program.cc:98
#7  0x0000000000419925 in main (argc=<optimized out>, argv=<optimized out>) at /export/home/pb2/build/sb_0-20188648-1472127135.37/mysqlcom-pro-5.7.15/client/dump/program.cc:277
(gdb)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.