# Facing Connection Closure Issues with Percona MySQL and ProxySQL Load Balancing

**URL:** <https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290>\
**Category:** Percona XtraDB Cluster 8.x\
**Tags:** mysql\
**Created:** [February 6, 2024, 12:23pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290 "2024-02-06T12:23:01Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 6, 2024, 12:23pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/1 "2024-02-06T12:23:01Z")

</div>

Hi everyone,

I hope you’re doing well.

I’ve been encountering some issues with Percona MySQL and ProxySQL for load balancing in my web applications. Here’s a brief overview of the problem:

**Problem Description:**

- After deploying my web applications, they initially work fine for around 10 or 15 minutes.
- However, after this initial period, the connections to Percona MySQL through ProxySQL are being closed unexpectedly.

**Error Message:**

- The error message I’m receiving indicates that the connections are being closed prematurely. Here’s a sample error message:  
HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@… (No operations allowed after connection closed.)  
**Configuration Details:**

- I’m using Percona MySQL as the backend database and ProxySQL for load balancing.

- The connection pool is managed by HikariCP.

**Troubleshooting Steps Taken:**

- I’ve checked the database server logs and configuration, but I couldn’t find any issues on that end.
- I’ve also reviewed the configuration of ProxySQL and HikariCP, ensuring that they’re set up correctly.

**Request for Assistance:**

- I would appreciate any insights or suggestions on how to troubleshoot and resolve this issue.
- If anyone has experienced similar issues or has expertise in Percona MySQL and ProxySQL configuration, your guidance would be invaluable.

**Additional Information:**

- If there are specific logs, configurations, or settings that you’d like me to provide for further analysis, please let me know, and I’ll gladly share them.

Thank you in advance for your help and support.

Best regards,  
sandhoshpandi

---

<div class="post-metadata">

**Author:** ![Mughees\_Ahmed](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mughees_ahmed/32/9028_2.png) [@Mughees\_Ahmed](https://forums.percona.com/u/Mughees_Ahmed)\
**Post date:** [February 6, 2024, 12:33pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/2 "2024-02-06T12:33:40Z")

</div>

@Santhosh_Pandi, what is wait\_timeout variable in MySQL and maxLifetime in Hikari config ? also, check the same mysql-wait\_timeout in proxysql. thanks

---

<div class="post-metadata">

**Author:** ![Mughees\_Ahmed](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mughees_ahmed/32/9028_2.png) [@Mughees\_Ahmed](https://forums.percona.com/u/Mughees_Ahmed)\
**Post date:** [February 6, 2024, 12:37pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/3 "2024-02-06T12:37:13Z")

</div>

> [@Santhosh\_Pandi](#):
>
> HikariPool-1 - Failed to validate connection com.mysql.cj.jdbc.ConnectionImpl@… (No operations allowed after connection closed.)

will recommend to have set wait\_timeout variable in MySQL to be greater than maxLifetime in Hikari, so as to avoid connections being killed by MySQL. e,g by giving maxLifeTime(20000) value less than wait\_timeout(28800) in mysql

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 6, 2024, 1:03pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/4 "2024-02-06T13:03:15Z")

</div>

thank you for your immediate response,  
i will check and revert back soon

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 6, 2024, 1:17pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/5 "2024-02-06T13:17:55Z")

</div>

2024-02-06 13:10:47 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:40452  
2024-02-06 13:10:49 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:40478  
2024-02-06 13:10:49 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:40494  
2024-02-06 13:10:52 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:40542

this error was throws 20.113.158.117 this is applications is deployed

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 6, 2024, 2:01pm UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/6 "2024-02-06T14:01:42Z")

</div>

MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection this error also occur sir how to solve this issue

---

<div class="post-metadata">

**Author:** ![Mughees\_Ahmed](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mughees_ahmed/32/9028_2.png) [@Mughees\_Ahmed](https://forums.percona.com/u/Mughees_Ahmed)\
**Post date:** [February 7, 2024, 1:49am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/7 "2024-02-07T01:49:02Z")

</div>

@Santhosh_Pandi If the client disconnects in a not graceful way, proxysql will generate a warning.  
This can be useful in identifying patterns, for example, if the issue is mostly from an application and not from another  
ProxySQL 2.0.8 introduced a new variable `mysql-log_unhealthy_connections` to suppress messages related to unhealthy client’s connections being closed.

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 7, 2024, 8:27am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/8 "2024-02-07T08:27:27Z")

</div>

2024-02-07 08:25:38 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:43590  
2024-02-07 08:25:40 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:43632  
2024-02-07 08:25:42 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57662  
2024-02-07 08:25:42 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57670  
2024-02-07 08:25:42 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57686  
2024-02-07 08:25:43 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57696  
2024-02-07 08:25:43 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57702  
2024-02-07 08:25:44 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57714  
2024-02-07 08:25:48 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57748  
2024-02-07 08:25:48 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57758  
2024-02-07 08:25:49 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57774  
2024-02-07 08:25:52 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:57790  
2024-02-07 08:26:00 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:56634  
2024-02-07 08:26:02 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:35876  
2024-02-07 08:26:02 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:35888  
2024-02-07 08:26:04 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:35950  
20.113.158.117 this is ip is i had deployed server ip why this error can occurs ,but some time working and some time not working

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 7, 2024, 8:30am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/9 "2024-02-07T08:30:01Z")

</div>

2024-02-07 08:29:18 MySQL\_Session.cpp:5509:handler\_\_\_status\_CONNECTING\_CLIENT\_\_\_STATE\_SERVER\_HANDSHAKE(): [WARNING] mysql-max\_connections reached. Returning ‘Too many connections’  
2024-02-07 08:29:19 MySQL\_Session.cpp:5509:handler\_\_\_status\_CONNECTING\_CLIENT\_\_\_STATE\_SERVER\_HANDSHAKE(): [WARNING] mysql-max\_connections reached. Returning ‘Too many connections’ i have connect two users only but throw too many connections error

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [February 7, 2024, 11:15am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/10 "2024-02-07T11:15:37Z")

</div>

hread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.52.153.225:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.170.28.206:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:56252  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:56264  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36140  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36126  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36138  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:38420  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:38422  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:38430  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:43006  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.170.29.122:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.170.28.206:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.170.29.122:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.170.29.122:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.52.153.225:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3631:process\_data\_on\_data\_stream(): [WARNING] Detected broken idle connection on 20.52.153.225:3306  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:58736  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:56240  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:56262  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:42998  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:43004  
2024-02-07 11:13:06 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:43024  
2024-02-07 11:13:33 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:51450  
2024-02-07 11:13:36 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:51452  
2024-02-07 11:13:38 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:51462  
2024-02-07 11:13:43 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:42572  
2024-02-07 11:13:48 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:42590  
2024-02-07 11:14:11 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:50452  
2024-02-07 11:14:13 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:50424  
2024-02-07 11:14:18 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:50442  
2024-02-07 11:14:31 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:52808  
2024-02-07 11:14:33 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:45366  
2024-02-07 11:14:47 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36100  
2024-02-07 11:14:51 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36124  
how to solve above issue any one help me

---

<div class="post-metadata">

**Author:** ![Mughees\_Ahmed](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mughees_ahmed/32/9028_2.png) [@Mughees\_Ahmed](https://forums.percona.com/u/Mughees_Ahmed)\
**Post date:** [February 7, 2024, 11:48am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/11 "2024-02-07T11:48:42Z")

</div>

> [@Santhosh\_Pandi](#):
>
> mysql-max\_connections reached. Returning ‘Too many connections’

please configure mysql-max\_connections to same as MySQL db , if all three nodes are reader that mean writer is also writer, I belive you might have set max\_connection in proxysql host group as 1000 so for each node proxysql is able to create 1000 connection so set mysql-max\_connections=4000 on proxysql and max\_connections=4000 on MySQL db . thanks obviously laod and save proxysql variable to runtime and disks

---

<div class="post-metadata">

**Author:** ![Santhosh\_Pandi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/santhosh_pandi/32/11021_2.png) [@Santhosh\_Pandi](https://forums.percona.com/u/Santhosh_Pandi)\
**Post date:** [March 19, 2024, 6:27am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/12 "2024-03-19T06:27:45Z")

</div>

[quote=“Santhosh\_Pandi, post:10, topic:28290”]  
2024-02-07 11:14:33 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:45366  
2024-02-07 11:14:47 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36100  
2024-02-07 11:14:51 MySQL\_Thread.cpp:3939:process\_all\_sessions(): [WARNING] Closing unhealthy client connection 20.113.158.117:36124  
[/quote  
Any one facing this issue

---

<div class="post-metadata">

**Author:** ![Shah\_Harshil\_Kiranku](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/shah_harshil_kiranku/32/19932_2.png) [@Shah\_Harshil\_Kiranku](https://forums.percona.com/u/Shah_Harshil_Kiranku)\
**Post date:** [December 29, 2025, 9:56am UTC](https://forums.percona.com/t/facing-connection-closure-issues-with-percona-mysql-and-proxysql-load-balancing/28290/13 "2025-12-29T09:56:44Z")

</div>

Hii @Santhosh_Pandi I am also facing the same issue on ProxySQL, but I am getting little different error.

Error: **MySQL\_Thread.cpp:4126:ProcessAllSessions\_Healthy0(): [WARNING] Closing unhealthy client connection**

How to solve this issue?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/3X/1/7/17aa6b3167769b63e7605068d9667de191b5cc97.jpeg)
