-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to validate connection com.mysql.jdbc.JDBC4Connection@xxxxx (No operations allowed after connection closed.) #1034
Comments
Two things I can think of to check. 1) MySQL may be closing idle connections in a shorter period than HikariCP (default 10 minutes). 2) Some code (somewhere) is unwrapping the HikariCP connection to access the underlying MySQL connection, and then closing that instead of (or in addition to) the HikariCP Connection. |
Regarding the query closely following the validation error, that is to be expected. The thread wanted a connection, the one HikariCP wanted to give it failed validation, so HikariCP immediately gave it another. At which point the thread ran the query. |
It appears that the issue was with the HA Proxy timeout (that's between the app servers & the MySql servers) since I don't see the issue when I connect directly. For future readers, I set the HA Proxy timeout to the same value as MySql's |
Still no warnings, so the problem was caused by HAProxy terminating connections. @brettwooldridge thanks for the hint. |
We used Microsoft azure database, the maximum value of interactive_timeout in its server configuration is 240s, so the configuration 228800 in the database does not take effect. see https://docs.azure.cn/zh-cn/articles/azure-operations-guide/mysql/aog-mysql-connections-faq |
I had the same issue on a MySql Server 5.7.24 running on Azure. The issue is that the pool has the default idle timeout of 10 minutes, whilst the mysql server on azure has the idle timeout (mysql server variable is called wait_timeout) configured by default to 120 seconds. Hope that helps someone. |
We were encountering similar problems! Possible solution:We managed to get rid of those problem by using the following configuration:
Take into account that the the maxlifetime and idletimeout will not work if they have the exact same value (or if you use the default configuration)! |
Environment
We keep seeing
Failed to validate connection com.mysql.jdbc.JDBC4Connection@xxxxx (No operations allowed after connection closed.)
warnings in the logs at a high frequency. The interval between the logs seems rather random. What could be the cause of this? I have checked the relevant GitHub issues and StackOverflow but none of those cases seemed similar to our issue. What could possibly be closing the connections?A bit context:
We are using
sqlest
library in Scala, I've checked the relevant parts of the code and sqlest is not really doing anything out of ordinary (https://github.com/jhc-systems/sqlest/blob/master/sqlest/src/main/scala/sqlest/executor/Database.scala#L191)The database calls happen asynchronously using's Scala's
Future
class.Here's the Hikari config:
What's strange is that I see in the logs that right after the failed validation (in 5ms) there is an executed SQL.
Thanks in advance
The text was updated successfully, but these errors were encountered: