Skip to content

Commit

Permalink
Fix connection leak in mysqlpump
Browse files Browse the repository at this point in the history
Summary: If the connection pool isn't used, the connections may get leaked. I originally thought this would explain the mysterious connections in perfschema.connection test but unfortunately it doesn't fix that (at least it's not the only issue)

Reviewed By: zhichengzhu

Differential Revision: D16880918
  • Loading branch information
yizhang82 authored and inikep committed May 17, 2024
1 parent 5889eb6 commit bac926a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/dump/single_transaction_connection_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ Single_transaction_connection_provider::Single_transaction_connection_provider(
}
}
}

Single_transaction_connection_provider::
~Single_transaction_connection_provider() {
for (const auto &runner : m_runner_pool) {
delete runner;
}
m_runner_pool.clear();
}
1 change: 1 addition & 0 deletions client/dump/single_transaction_connection_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Single_transaction_connection_provider
unsigned int connections,
std::function<bool(const Mysql::Tools::Base::Message_data &)>
*message_handler);
virtual ~Single_transaction_connection_provider() override;

Mysql::Tools::Base::Mysql_query_runner *create_new_runner(
std::function<bool(const Mysql::Tools::Base::Message_data &)>
Expand Down

0 comments on commit bac926a

Please sign in to comment.