MySQL - How to diagnose cause of warning "Aborted connection - (Got timeout reading communication packets)"

gb2d picture gb2d · Aug 8, 2012 · Viewed 14.3k times · Source

I'm having some problems on our fairly busy Windows 2008 R2 web server, running MySQL.

Applications are intermittently crashing, and logs are commonly pointing to MySQL as a route cause, in that the applications cannot connect to MySQL. This is not affecting all users, just a few unlucky ones.

Having turned on warning logging in MySQL, I am seeing repeated logs of the following warning:

[Warning] Aborted connection 7153 to db user: 'XXXX' host: 'XXXXXX' (Got timeout reading communication packets)

The docs here http://dev.mysql.com/doc/refman/5.0/en/communication-errors.html suggest a range of potential network related causes.

Some of the configuation under "Advanced Networking":

Max Packet Size: 128 M (We increased this from 64 M yesterday) Wait timeout: 20 Max Connections: 1000 Max Conn per: 1000 Retry count: 5

My question is, how can I better diagnose what is causing this issue, rather than just playing with settings and waiting?

Thanks in advance

Answer

gb2d picture gb2d · Sep 17, 2012

This was a tricky issue to solve, but we eventually found a couple of thousand apparently orphaned TCP connections open (using Task Manager > Resource Monitor), which had been generated by an email send process.

Since MySQL connections are TCP dependent, the db server was suffering as a result.