日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

mysql报错last packet_mysql The last packet successfully received

發布時間:2024/7/23 64 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql报错last packet_mysql The last packet successfully received 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

mysql服務器最近老是報錯,內容如下:

The last packet successfully received from the server was 65,502,275 milliseconds ago. The last packet sent successfully to the server was 65,502,276 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

主要的意思是:: 數據庫有長連接,由于長時間沒有使用,并且空閑時間超過了wait_timeout設置的時間。 數據庫到了wait_timeout設定的時間,自動釋放了鏈接。

客戶端還有這個長連接,客戶端使用這個長連接向mysql數據庫發送消息,可是這個鏈接數據庫服務器端已經釋放了,所以爆出上面的錯誤.

如果你剛好在數據庫超時的第一時間內看到日志記錄的話那么,第一次超時發生的錯誤就是這樣的:

ERROR [org.hibernate.util.JDBCExceptionReporter] - Communications link failure

Last packet sent to the server was 0 ms ago.

如果不是第一次超時后執行,以后每次報錯就變成嵌套的錯誤了,就是下面這樣:

ERROR [org.hibernate.util.JDBCExceptionReporter] -

No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:

解決辦法:由于項目中代碼比較多,查找哪一個長連接沒有釋放很麻煩,過程如下:

(1)查看報錯日志的詳細信息,看關系到哪一個dao類出現的問題

(2)然后將mysql連接池最大、最小數據設置成3,1.

(3)然后打開3個瀏覽器,進行操作

(4)發現項目確實很慢,然后詳細看了一下代碼,確實由于一個地方連接池沒有關系,導致鏈接一直存在,沒有釋放。

更多信息請查看IT技術專欄

總結

以上是生活随笔為你收集整理的mysql报错last packet_mysql The last packet successfully received的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。