wsrep-slave-threads is counted towards max_connections

Bug #1315588 reported by Raghavendra D Prabhu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
New
Undecided
Unassigned
5.5
New
Undecided
Unassigned
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Status tracked in 5.6
5.5
Fix Released
Medium
Unassigned
5.6
Fix Released
Medium
Unassigned

Bug Description

Originally reported here, https://mariadb.atlassian.net/browse/MDEV-6206

Easy to reproduce.

 /pxc/bin/mysqld --defaults-file=/pxc/etc/my.cnf.local --basedir=/pxc --user=mysql --wsrep-debug --wsrep-new-cluster --wsrep-start-position='2d2c14c1-cdcd-11e3-9eff-3eb6075d3f68:0' --max-connections=50 --wsrep-slave-threads=200

starting new mysql client gives "ERROR 1040 (HY000): Too many connections"

Related branches

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

This is because of:

  mysql_mutex_lock(&LOCK_connection_count);
  ++connection_count;
  mysql_mutex_unlock(&LOCK_connection_count);

in start_wsrep_THD.

and subsequent check:

  if (*thd->scheduler->connection_count >=
      *thd->scheduler->max_connections + 1 || abort_loop)

in create_new_thread.

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

Since start_wsrep_THD is also used for creating appliers (the slave threads), the fix here would be to not increment that for appliers: wsrep_replication_process(THD*) and also wsrep_rollback_process.

Revision history for this message
Philip Stoev (philip-stoev-f) wrote :

MTR test case. Please push when fixing the bug

#
# LP:1315588 wsrep-slave-threads is counted towards max_connections
#

--source include/galera_cluster.inc
--source include/have_innodb.inc

--let $max_connections_orig = `SELECT @@max_connections`
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`

SET GLOBAL max_connections = 5;
SET GLOBAL wsrep_slave_threads = 10;

SELECT COUNT(*) > 5 FROM INFORMATION_SCHEMA.PROCESSLIST;

--let $galera_connection_name = node_1a
--let $galera_server_number = 1
--source include/galera_connect.inc

--connection node_1a
SELECT 1 FROM DUAL;

--eval SET GLOBAL max_connections = $max_connections_orig
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1103

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.