Skip to content

Commit 924dbff

Browse files
committed
Bug #31696241: MAIN.MYSQLPUMP FAILS WITH SEGMENTATION FAULT
RB#25303 A stabilization fix to make sure the concurrently accessed structures are operated within a lock. Also added a new code to the accepted error codes.
1 parent f4818d7 commit 924dbff

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

client/dump/thread_specific_connection_provider.cc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -49,8 +49,11 @@ Thread_specific_connection_provider::get_runner(
4949
*/
5050
runner->run_query("SET TIME_ZONE='+00:00'");
5151

52-
std::lock_guard<std::mutex> lock(mu);
53-
m_runners[std::this_thread::get_id()] = runner;
52+
{
53+
std::lock_guard<std::mutex> lock(mu);
54+
assert(m_runners[std::this_thread::get_id()] == nullptr);
55+
m_runners[std::this_thread::get_id()] = runner;
56+
}
5457
}
5558
// Deliver copy of original runner.
5659
return new Mysql::Tools::Base::Mysql_query_runner(*runner);
@@ -61,7 +64,10 @@ Thread_specific_connection_provider::Thread_specific_connection_provider(
6164
: Abstract_connection_provider(connection_factory) {}
6265

6366
Thread_specific_connection_provider::~Thread_specific_connection_provider() {
64-
for (const auto &id_and_runner : m_runners) {
65-
delete id_and_runner.second;
67+
{
68+
std::lock_guard<std::mutex> lock(mu);
69+
for (const auto &id_and_runner : m_runners) {
70+
delete id_and_runner.second;
71+
}
6672
}
6773
}

mysql-test/t/mysqlpump.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ FLUSH PRIVILEGES;
220220

221221
--exec $MYSQL_PUMP --include-databases=db1 --log-error-file=$MYSQLTEST_VARDIR/log/bug27096081.log > $MYSQLTEST_VARDIR/tmp/bug27096081.sql
222222

223-
--error 23, 42, 169, 1449
223+
--error 23, 42, 169, 1449, -1073741819
224224
--exec $MYSQL_PUMP --include-databases=db2 --log-error-file=$MYSQLTEST_VARDIR/log/bug27096081.log > $MYSQLTEST_VARDIR/tmp/bug27096081.sql
225225

226226
--let SEARCH_FILE= $MYSQLTEST_VARDIR/log/bug27096081.log

0 commit comments

Comments
 (0)