Warning: mysql_connect(): Too many connections

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
scrubadub
Posts: 1
Joined: Thu Dec 02, 2004 10:42 am

Warning: mysql_connect(): Too many connections

Post by scrubadub »

i got some problems, and a couple are with cacti.

the main problem is with the "waiting on 1/1 pollers" when running php pollers.php (same problem as http://forums.cacti.net/viewtopic.php?t ... c&start=15 though reading through the suggestions didnt help me)

so let's start the info section (i'm in debug mode)

Code: Select all

cacti # php -v
PHP 4.3.9 (cli) (built: Dec  1 2004 15:50:47)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

Code: Select all

cacti # php cmd.php
#!/usr/bin/php -q
12/02/2004 11:18:14 AM - CMDPHP: Poller[0] PHP Script Server Started Properly
12/02/2004 11:18:14 AM - CMDPHP: Poller[0] Host[1] PING: Host is Alive
12/02/2004 11:18:14 AM - CMDPHP: Poller[0] Host[1] SNMP: SNMP not performed due to setting or ping result.
12/02/2004 11:18:15 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/linux_memory.pl MemFree:, output: 438216
12/02/2004 11:18:15 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/linux_memory.pl SwapFree:, output: 434616
12/02/2004 11:18:15 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/loadavg_multi.pl, output: 1min:0.00 5min:0.00 10min:0.01
12/02/2004 11:18:15 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/unix_users.pl, output: 2
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/unix_processes.pl, output: 57
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/linux_memory.pl SwapFree:, output: 434616
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/loadavg_multi.pl, output: 1min:0.00 5min:0.00 10min:0.01
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/unix_users.pl, output: 2
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/unix_processes.pl, output: 57
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/query_unix_partitions.pl  get used /dev/hda3, output: 1831752
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/query_unix_partitions.pl  get available /dev/hda3, output: 34168900
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Host[1] CMD: perl /web/scripts/linux_memory.pl MemFree:, output: 437352
12/02/2004 11:18:16 AM - CMDPHP: Poller[0] Time: 1.9324 s, Theads: N/A, Hosts: 1

Code: Select all

cacti # php poller.php
12/02/2004 11:19:09 AM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /web/poller.php, ARGS:  0 1]
Waiting on 1/1 pollers.
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '1min:0.00' [map 1min->load_1min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '5min:0.00' [map 5min->load_5min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '10min:0.01' [map 10min->load_15min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '1min:0.00' [map 1min->load_1min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '5min:0.00' [map 5min->load_5min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] Parsed MULTI output field '10min:0.01' [map 10min->load_15min]
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_hdd_free_104.rrd --template hdd_free:hdd_used 1102004294:34168900:1831752
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_proc_103.rrd --template proc 1102004294:57
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_users_102.rrd --template users 1102004294:2
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_load_1min_101.rrd --template load_1min:load_5min:load_15min 1102004294:0.00:0.00:0.01
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_mem_swap_100.rrd --template mem_swap 1102004294:434616
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_proc_7.rrd --template proc 1102004294:57
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_users_6.rrd --template users 1102004294:2
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_load_1min_5.rrd --template load_1min:load_5min:load_15min 1102004294:0.00:0.00:0.01
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_mem_swap_4.rrd --template mem_swap 1102004294:434616
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_mem_buffers_3.rrd --template mem_buffers 1102004294:438216
12/02/2004 11:19:09 AM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /web/rra/localhost_mem_buffers_99.rrd --template mem_buffers 1102004294:437352
OK u:0.00 s:0.00 r:0.20
OK u:0.00 s:0.00 r:0.21
OK u:0.00 s:0.00 r:0.21
OK u:0.01 s:0.00 r:0.25
OK u:0.01 s:0.00 r:0.26
OK u:0.01 s:0.00 r:0.27
OK u:0.01 s:0.00 r:0.27
OK u:0.01 s:0.00 r:0.27
OK u:0.01 s:0.00 r:0.27
OK u:0.01 s:0.00 r:0.28
OK u:0.01 s:0.00 r:0.28
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
this is where i kill it but now when i try to log in

Code: Select all

Warning: mysql_connect(): Too many connections in /web/lib/adodb/drivers/adodb-mysql.inc.php on line 324

Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.
I took the advise of another thread on here and upped some buffers in /etc/mysql/my.cnf but still i have to wait until the connections timeout. I am only monitoring localhost just to get this working

Code: Select all

cacti # uname -a
Linux traffic 2.4.26-gentoo-r9 #2 Wed Dec 1 11:17:42 EST 2004 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux

Code: Select all

traffic cacti # apache2 -v
Server version: Apache/2.0.52
Server built:   Nov 10 2004 12:20:34
running 0.8.6b, I got one initial spike in the graph when i first ran polling.php but now it does not update with either cmd.php or polling.php
another question i had is what actually created the rrd files, the first time i ran polling it complained that they didnt exist (owner apache for ./cacti/*) then i ran cmd, then i ran polling and it spiked the graphs
i see all this talk about cactid yet it doesnt seem to exist on my system, could this be the single problem? I've tried installing off gentoo ebuilds and the tar.gz on your site with the same results. Also what seemed to fix thomas80's problem on the post referenced on the top is cactid.c so i assume i'm supposed to make this? where should i put the executable? will this solve the mysql dos problem?

can anyone point me in the right direction? request more diagnostics if needed.
User avatar
jshanley
Posts: 11
Joined: Fri Jul 30, 2004 7:39 pm

Post by jshanley »

Code: Select all

Warning: mysql_connect(): Too many connections in /web/lib/adodb/drivers/adodb-mysql.inc.php on line 324 
http://dev.mysql.com/doc/mysql/en/Too_m ... tions.html

Perhaps this is your primary problem, and is causing the other problems?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This is very good news, and not. Please edit the following file "<cacti>/lib/database.php and change the line that says "PConnect" to "Connect". Then tell me if the problem goes away. My suspicion is that your database is not releasing persistent connections fast enough for your poller, or the persistent connections are not working.

Otherwise, the problem will be with not enough concurrent connections to MySQL. To increase, please check the MySQL manual. You must also set a realistic timeout on Persistent connections if you plan on using them.

Right now, the patched code utilizes them.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests