summaryrefslogtreecommitdiff
path: root/sql/threadpool_unix.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2013-01-30 17:25:02 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2013-01-30 17:25:02 +0100
commit1701ee335740c970696fab081cfeac582991076d (patch)
treea4f9f5223da3521294f884cbf8d29012092d9873 /sql/threadpool_unix.cc
parent52fbe44fbbe60ecaba6453884ec1ad32755d7a04 (diff)
downloadmariadb-git-1701ee335740c970696fab081cfeac582991076d.tar.gz
MDEV-4113: Assertion (group->connection_count > 0) fails with Percona server in replication test.
Assertion happens in replication thread during THD destruction, when thread calls my_sync(), which in turn calls thd_wait_begin() callback. Connection count can be 0, because the counter was decremented before THD destructor. This assertion currently reproducible only in Percona server and not in MariaDB, due to differences in replication code. Fixed by moving code to decrement connection counter after the THD destructor.
Diffstat (limited to 'sql/threadpool_unix.cc')
-rw-r--r--sql/threadpool_unix.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc
index da38d64fa4d..e324fa697da 100644
--- a/sql/threadpool_unix.cc
+++ b/sql/threadpool_unix.cc
@@ -1247,11 +1247,12 @@ static void connection_abort(connection_t *connection)
DBUG_ENTER("connection_abort");
thread_group_t *group= connection->thread_group;
+ threadpool_remove_connection(connection->thd);
+
mysql_mutex_lock(&group->mutex);
group->connection_count--;
mysql_mutex_unlock(&group->mutex);
-
- threadpool_remove_connection(connection->thd);
+
my_free(connection);
DBUG_VOID_RETURN;
}