Page 1 of 1

Ubuntu 8.04 ZM 1.24.1 mysql_pconnect error

Posted: Wed Mar 25, 2009 6:12 pm
by the_crowbar
I fixed a problem today that I was unable to find any posts about so I thought I would document what it was.

I have an Ubuntu 8.04 AMD64 server setup with ffmpeg 0.5 and ZM 1.24.1. I have a total of 32 monitors configured. One client was able to view montage but as soon as second client tried I started getting php errors.

I no longer have the exact error in front of me, but it had mysql_pconnect "too many connections" and database.php in it. After a little digging I found a php setting to limit the number of mysql connections. On Ubuntu 8.04 it is set to -1 (unlimited).

After more Googling I found that MySQL also has a client limit. There was no setting for it, but I added a line to the [mysqld] section of /etc/mysql/my.cnf

Code: Select all

# Increase the maximum number of connections
max_connections		= 500
You can also view the current (maybe default) setting from within mysql with this command:

Code: Select all

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 500   | 
+-----------------+-------+
1 row in set (0.00 sec)
I still have a couple more issues to fix (one show stopper), but ZM 1.24.1 seems to be an improvement from 1.23.

Cheers,
the_crowbar

Posted: Wed Mar 25, 2009 6:20 pm
by the_crowbar
I found a window still open with the error. Here it is:

Code: Select all

Warning: mysql_pconnect() [function.mysql-pconnect]: Too many connections in /var/www/includes/database.php on line 32
Could not connect to database: Too many connections
While researching the solution to this error I found quite a bit of discussion on pconnect versus connect. I ended up changing the line in database.php to use mysql_connect instead of mysql_pconnect. My ZM/Apache/MySQL is all on one box and so the time required to start a new connection each time is minimal.

Cheers,
the_crowbar

Posted: Thu Mar 26, 2009 4:12 am
by Blazer
Wow 32 monitors...that must be a beefy server! Thanks for posting your experience, good to have things for the search to find when people have similar problems :)

Posted: Thu Mar 26, 2009 7:06 am
by the_crowbar
32 320x240 is really not much. The system is a 2X quad core Xeon with 4GB of RAM. Doing simple MoDect with a single zone per monitor system load averages well under 1. As I go along I will be doing more involved detection that may push the load up more.

Cheers,
the_crowbar