lmce_game mysql leak bug
I have lmce_game installed with a decent amount of MAME ROMs. Lately I have been getting errors that all of the mysql connections are being used (default 200 connections). See error below:
Warning: mysql_connect() [Too many connections in /var/www/lmce-admin/include/adodb/drivers/adodb-mysql.inc.php on line 338
Fatal error: mysql error: 1040: Too many connections in CONNECT(localhost, '', '', pluto_main) in /var/www/lmce-admin/include/adodb/adodb-errorhandler.inc.php on line 77
To debug the problem, I upped the max_connections mysql setting to 2000. Shortly thereafter, I was again getting warnings of all of the connections being used. I was lucky enough to catch it as it was happening by running show full processlist\g from the mysql prompt repeatedly until I could see what was causing the errors. Before long, the list was showing user lmce_game was taking up almost 2000 connections from localhost. See short snippet of the output below:
... ... | 48711 | root | localhost | lmce_game | Sleep | 1314 | | NULL | | 48712 | root | localhost | lmce_game | Sleep | 1314 | | NULL | | 48713 | root | localhost | lmce_game | Sleep | 1313 | | NULL | | 48714 | root | localhost | lmce_game | Sleep | 1313 | | NULL | | 48715 | root | localhost | lmce_game | Sleep | 1312 | | NULL | | 48716 | root | localhost | lmce_game | Sleep | 1312 | | NULL | | 48717 | root | localhost | lmce_game | Sleep | 1311 | | NULL | | 48718 | root | localhost | lmce_game | Sleep | 1311 | | NULL | | 48719 | root | localhost | lmce_game | Sleep | 1310 | | NULL | | 48720 | root | localhost | lmce_game | Sleep | 1310 | | NULL | | 48721 | root | localhost | lmce_game | Sleep | 1310 | | NULL | | 48722 | root | localhost | lmce_game | Sleep | 1309 | | NULL | | 48723 | root | localhost | lmce_game | Sleep | 1309 | | NULL | | 48724 | root | localhost | lmce_game | Sleep | 1308 | | NULL | | 48725 | root | localhost | lmce_game | Sleep | 1308 | | NULL | | 48726 | root | localhost | lmce_game | Sleep | 1307 | | NULL | | 48727 | root | localhost | lmce_game | Sleep | 1307 | | NULL | +-------+--------+--------------------+----------------+---------+-------+-------+-----------------------+ 2001 rows in set (0.01 sec
Somewhere, lmce_game is acessing the database and not closing the connection afterwards it seems.