天天看點

記錄解決 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告問題

具體警告内容:

2020-01-13 14:26:58.733  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection [email protected] (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2020-01-13 14:26:58.735  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection [email protected] (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
2020-01-13 14:26:58.737  WARN 15263 --- [http-nio-8830-exec-10] com.zaxxer.hikari.pool.PoolBase          : MyHikariCP - Failed to validate connection [email protected] (No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value.
           

看到的大部分解決方案是修改hikari的 max-lifetime配置(不是改大就是該小),各種方法都試過了,然而都沒有解決這個問題。

還有一種比較接近的方案就是:

首先在mysql中執行 

SHOW VARIABLES LIKE "%timeout%";
           

得到結果:

記錄解決 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告問題

坑就坑在這裡了,這裡查出來的wait_timeout的值顯示的是28800秒,誤導我以為資料庫配置的wait_timeout就是28800,然而并不是,一次偶然的機會,執行了下 vim /etc/my.cnf ,忽然看到下面的畫面:

記錄解決 springboot2.0 hikaricp - failed to valid... no operations allowed after connection closed.警告問題

我的天,這個玩意誰改的。。。。。

好了,問題找到了,把這項改成28800(8小時),再重新開機mysql

service mysqld restart
           

 問題解決。。。

繼續閱讀