MySQL ERROR Got an error reading communication packets

pursuer.chen發表於2016-09-08

介紹

經常會在錯誤日誌中看到這個報錯,首先我們可以從show GLOBAL status like '%Aborte%';裡面看看兩種錯誤連線的數量,以下是複製官方文件的解釋。   

 

Aborted_connects 

If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connection attempts can occur for the following reasons:

If these kinds of things happen, it might indicate that someone is trying to break into your server! If the general query log is enabled, messages for these types of problems are logged to it.

 

對於Aborted_connects錯誤的大概原因有:

1.客戶端連線一個沒有授權的資料庫

2.密碼錯誤

3.連線包資訊錯誤

4.連線超時(預設10s)

Aborted_clients

If a client successfully connects but later disconnects improperly or is terminated, the server increments the Aborted_clients status variable, and logs an Aborted connection message to the error log. The cause can be any of the following:

Other reasons for problems with aborted connections or aborted clients:

  • The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld. See Section B.5.2.10, “Packet Too Large”.

  • Use of Ethernet protocol with Linux, both half and full duplex. Some Linux Ethernet drivers have this bug. You should test for this bug by transferring a huge file using FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. Switch the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and test the results to determine the best setting.

  • A problem with the thread library that causes interrupts on reads.

  • Badly configured TCP/IP.

  • Faulty Ethernets, hubs, switches, cables, and so forth. This can be diagnosed properly only by replacing hardware.

 

對於 Aborted_clients的原因大概有

1.客戶端沒有執行mysql_close()關閉

2.由於連線一直沒有關閉導致時間超過wait_timeout or interactive_timeout這兩個變數的值(這兩個變數的超時時間是8小時)

3.客戶端在程式執行過程中結束

4.max_allowed_packet包設的過小

5.網路原因

6.執行緒bug等

總結

 

 

 

備註:

    作者:pursuer.chen

    部落格:http://www.cnblogs.com/chenmh

本站點所有隨筆都是原創,歡迎大家轉載;但轉載時必須註明文章來源,且在文章開頭明顯處給明連結。

《歡迎交流討論》

相關文章