MySQL processes - quickly rising

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

Moderators: Developers, Moderators

villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

MySQL processes - quickly rising

Post by villieb »

Morning,

I noticed this morning that Cacti wasn't logging any data in any of my graphs. I couldn't SSH to the server. I managed to get console access to the server and saw some errors (I didn't note them down :oops: )

Looking at the MySQL Process List, I am seeing right now, 112 rows of

| 455 | cacti | localhost | cacti | Sleep | 4 | | NULL |
| 459 | cacti | localhost | cacti | Sleep | 4 | | NULL |
| 461 | cacti | localhost | cacti | Sleep | 4 | | NULL |
| 463 | cacti | localhost | cacti | Sleep | 0 | | NULL |
| 470 | cacti | localhost | cacti | Sleep | 2 | | NULL |
| 471 | cacti | localhost | cacti | Sleep | 2 | | NULL |
| 473 | cacti | localhost | cacti | Sleep | 2 | | NULL |
| 475 | cacti | localhost | cacti | Sleep | 0 | | NULL |
| 478 | cacti | localhost | cacti | Sleep | 0 | | NULL |

One of the colomns, time, is as high as 1619...

Is this normal?
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

I now have 151 rows after checking the processlist...
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

What's the overall status of the server:

Diskspace ( df -h )
Processes ( ps -efwww )

Did you try a restart of mysql ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

Diskspace:
/dev/mapper/nhs--cacti-root 108G 2.8G 99G 3% /
udev 486M 4.0K 486M 1% /dev
tmpfs 198M 256K 198M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 495M 0 495M 0% /run/shm
/dev/sda1 228M 50M 167M 23% /boot

Processes:
Attached in process.txt

I did try restarting the sql process but the number of entries grow quickly...
Attachments
processes.txt
(18.01 KiB) Downloaded 122 times
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

It seems like the poller is being called either too often, or hangs.

Can you check /var/log/cacti/poller-error.log for any issues ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

localadmin@nhs-cacti:/var/log/cacti$ sudo tail poller-error.log
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383
PHP Warning: mysql_pconnect(): Too many connections in /usr/share/php/adodb/drivers/adodb-mysql.inc.php on line 383

That line in the adodb-mysql.inc.php contains:

Code: Select all

if (ADODB_PHPVER >= 0x4300)
                        $this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword,$this->clientFlags);
                else
                        $this->_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword);
Thanks
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

Edit your /etc/my.cnf file and add a line like the following to it:

Code: Select all

max_connections = 250
then restart your mysql server. and check the logfile and processes again.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

Thanks - I've edited the file /etc/mysql/my.cnf

So far, the processes within mysql is up at 61 rows...

I'm not seeing the errors as before in the poller log file...

Fingers crossed...
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

Ok,

If you can, maybe a system restart (or manually kill to the spine/poller processes ) to get rid of these "zombies" would be fine.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

I've just restarted the server... output from the show processlist is empty (apart from the show processlist process)....

Lets see how this gets on now
villieb
Cacti User
Posts: 75
Joined: Fri Nov 09, 2012 5:14 am

Re: MySQL processes - quickly rising

Post by villieb »

Up at 33 rows when looking at the mysql processlist
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

Are there still errors in the poller-error.log showing up ?

You could as well check if there are any error messages from mysql or in your syslog.
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
DrLightman
Posts: 2
Joined: Wed Apr 20, 2016 11:40 am

Re: MySQL processes - quickly rising

Post by DrLightman »

Hello, I'm sorry for the gravedig, but I'm experiencing the very same behaviour described here and since it's 3 years old at least, I suppose it's still around.

The more the sysadmin keeps the tool open in the browser, the more mysql connections/processes spawn and don't properly close. They actually fill in the connections of the webserver and may cause other clients/processes to fail to connect in the end.

Image

Do you think of any workaround to let it close those connections properly or maybe use one connection only.

Thank you.
DrLightman
Posts: 2
Joined: Wed Apr 20, 2016 11:40 am

Re: MySQL processes - quickly rising

Post by DrLightman »

Hello?
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: MySQL processes - quickly rising

Post by phalek »

Do you have any plugins installed, if yes, which ones and version ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests