mysql keeps using memory and swap , never releases memory

03-30-2014, 11:05 AM

[problem]
mysql keep using ram and swap , but it never releasing the memory until it out of memory
[environment]
physical machine: dell r710,32G RAM,16G SWAP,raid10,146G*6 disks
[mysql version]
Server version: 5.0.67-percona-highperf-log Source distribution ( we have another 4 mysql servers, only the 5th one has this problem)

Comment

Finally we found out the reason , it's a bug of mysql 5.0.67.
MySQL5.0.67 write the client dynamic information into information_schema.CLIENT_STATISTICS , client_statistics is in memory.
Normally, one client will have only one record , but this time, we set "client_ip client_hostname" in /etc/hosts , and the length of client_hostname longer than 16 character , which is longer than length of information_schema.client_statistics.client column varchar(16), then mysql will keep update the record about client_hostname in client_statistics, but this is a bug, every time mysql update client_statistics to update client_hostname's record , it will insert a new record with wrong values. As the time going , there will be more and more records in client_statistics , which is in the memory , it won't be released until you restart mysql server.
So, after we change the "client_ip client_hostname" in /etc/hosts, restarting mysql server, everything becomes ok.