Databases 7 min read

Analysis of MySQL Router “Too Many Connections” Error in Versions 8.0.29/8.0.30 and Work‑around

The article investigates why MySQL Router 8.0.29/8.0.30 reports “ERROR 1040 (HY000): Too many connections to MySQL Router” even when the backend MySQL server has only a few connections, reproduces the issue, analyzes packet traces, and concludes that the problem exists in those versions but not in 8.0.28 or 8.0.21, likely due to a new connection‑pooling feature.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Analysis of MySQL Router “Too Many Connections” Error in Versions 8.0.29/8.0.30 and Work‑around

Background – Developers encountered the error ERROR 1040 (HY000): Too many connections to MySQL Router while the MySQL server showed only a handful of active sessions. Investigation revealed that in MySQL Router versions 8.0.29 and 8.0.30, TCP connections are not released after the wait_timeout expires, leading to connection exhaustion. The issue persists in 8.0.30, so a downgrade was used as a temporary fix.

Problem Reproduction

MySQL server version:

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.28   |
+-----------+
1 row in set (0.01 sec)

Router version:

shell> ./mysqlrouter -V
MySQL Router  Ver 8.0.30 for Linux on x86_64 (MySQL Community - GPL)

Router configuration (port 8030, max_connections = 3) to simplify reproduction:

egrep 'max|port' mysqlrouter.conf 
max_connections = 3
bind_port = 8030

Three sessions were opened, each with wait_timeout = 10 so they should close after ten seconds:

mysql> show processlist;
... (output showing three sleeping sessions) ...

After the timeout, a new connection attempt fails:

shell> mysql -uhaha -p1 -h10.186.65.132 -P8030
ERROR 1040 (HY000): Too many connections to MySQL Router

Netstat shows that the router’s TCP sockets remain in ESTABLISHED state on both the router and the MySQL client side, confirming that the connections were not released.

Packet Analysis

The capture on the MySQL server side shows a normal three‑way handshake, followed by a timeout‑driven disconnect, but the router never sends the FIN, ACK packet. Consequently the router’s side stays in CLOSE_WAIT (or the client in FIN_WAIT2 ), exhausting the allowed connections.

Images from the original capture illustrate the missing goodbye packet and the resulting state:

In contrast, a capture from router version 8.0.28 shows the router actively sending the FIN, ACK packet, allowing the TCP connection to close cleanly.

Conclusion

Testing confirms that the “Too many connections” problem occurs in MySQL Router 8.0.29 and 8.0.30, while versions 8.0.28 and 8.0.21 do not exhibit the issue. The regression is likely related to the new connection‑pooling feature introduced in 8.0.29.

Users experiencing this symptom should consider downgrading to a stable version (e.g., 8.0.28) or adjusting tcp_fin_timeout on Linux as a temporary mitigation.

debuggingMySQLconnection poolingMySQL RouterTCP connectionToo many connections
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.