Too many open connections

Hi,
I am having trouble with my Freepbx crashing every few days.

FreePBX 15.0.17.34
PBX Distro: 12.7.8-2012-1.sng7
Asterisk Version: 16.15.0
All modules updated

I have read other posts here. I want to be ready to get more information when it happens again. This is a production system, so I do not have much time before a restart, so it runs fine again.

I am aware of
Mysql
show processlist;

Any other hints?

Thanks,
Stephan

This is the error:

[[email protected] -]# fwconsole restart
Exception: SQLSTATE[08004] [1040] Too many connections::SQLSTATE[08004] [1040] Too many connections in file /vax/www/html/admin/libraries/utility.functions.php on line 120
Stack trace:

  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:120
  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:149
  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:144
  4. PD0->_construct() /var/www/html/admin/libraries/BMO/Database.class.php:144
  5. FreePBX\Database-> _construct() /var/www/html/admin/libraries/BMO/FreePBX.c lass.php:71
  6. FreePBX-> _construct() /var/www/html/admin/bootstrap.php:144
  7. require_once() /etc/freepbx.conf:11
  8. include_once() /var/lib/astexisk/bin/fwconsole:12

How many connections are you seeing? You can up the allowed number of connections, but this is usually not needed. More importantly, you should see what is connecting. This would be a typical result of that command:

You should take a look at this file: /vax/www/html/admin/libraries/utility.functions.php I’m not familiar with a /vax/ directory that should be in the file system. But then again, I don’t dig into FreePBX as much as I used to.

Today it crashed again.

MariaDB [(none)]> show processlist;
±-------±------------±----------------±--------------±--------±-----±------±-----------------±---------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
±-------±------------±----------------±--------------±--------±-----±------±-----------------±---------+
| 116786 | freepbxuser | localhost | asterisk | Sleep | 3023 | | NULL | 0.000 |
| 233176 | freepbxuser | localhost:53930 | asterisk | Sleep | 894 | | NULL | 0.000 |
| 235464 | freepbxuser | localhost | asteriskcdrdb | Sleep | 638 | | NULL | 0.000 |
| 235488 | freepbxuser | localhost | asteriskcdrdb | Sleep | 638 | | NULL | 0.000 |
| 237571 | freepbxuser | localhost | asterisk | Sleep | 526 | | NULL | 0.000 |
| 237573 | freepbxuser | localhost | asterisk | Sleep | 526 | | NULL | 0.000 |
| 237575 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237577 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237579 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237582 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237583 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237585 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237587 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237589 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237591 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237594 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237595 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237598 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237599 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237601 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237603 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237605 | freepbxuser | localhost | asterisk | Sleep | 525 | | NULL | 0.000 |
| 237607 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237610 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237611 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237613 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237616 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237621 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237624 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237626 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237628 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237630 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237632 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237634 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237636 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237638 | freepbxuser | localhost | asterisk | Sleep | 524 | | NULL | 0.000 |
| 237641 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237643 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237644 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237647 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237648 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237651 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237652 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237655 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237656 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237658 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237660 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237662 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237664 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237666 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237669 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237671 | freepbxuser | localhost | asterisk | Sleep | 523 | | NULL | 0.000 |
| 237673 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237674 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237676 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237678 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237681 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237682 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237685 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237686 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237689 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237691 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237693 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237694 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237697 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237698 | freepbxuser | localhost | asterisk | Sleep | 522 | | NULL | 0.000 |
| 237701 | freepbxuser | localhost | asterisk | Sleep | 521 | | NULL | 0.000 |
| 237703 | freepbxuser | localhost | asterisk | Sleep | 521 | | NULL | 0.000 |
| 237705 | freepbxuser | localhost | asterisk | Sleep | 521 | | NULL | 0.000 |
| 237706 | freepbxuser | localhost | asterisk | Sleep | 521 | | NULL | 0.000 |
| 238145 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238146 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238147 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238148 | freepbxuser | localhost | asterisk | Sleep | 147 | | NULL | 0.000 |
| 238149 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238150 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238151 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238152 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238153 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238154 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238155 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238156 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238157 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238158 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238159 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238160 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238161 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238162 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238163 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238164 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238165 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238166 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238167 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238168 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238169 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238170 | freepbxuser | localhost | asterisk | Sleep | 142 | | NULL | 0.000 |
| 238171 | freepbxuser | localhost | asterisk | Sleep | 142 | | NULL | 0.000 |
| 238172 | freepbxuser | localhost | asterisk | Sleep | 147 | | NULL | 0.000 |
| 238173 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238174 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238175 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238176 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238177 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238178 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238179 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238180 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238181 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238182 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238183 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238184 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238185 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238186 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238187 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238188 | freepbxuser | localhost | asterisk | Sleep | 146 | | NULL | 0.000 |
| 238189 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238190 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238191 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238192 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238193 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238194 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238195 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238196 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238197 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238198 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238199 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238200 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238201 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238202 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238203 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238204 | freepbxuser | localhost | asterisk | Sleep | 145 | | NULL | 0.000 |
| 238205 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238206 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238207 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238208 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238209 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238213 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238215 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238217 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238218 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238219 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238220 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238221 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238222 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238223 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238224 | freepbxuser | localhost | asterisk | Sleep | 144 | | NULL | 0.000 |
| 238225 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238226 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238227 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238228 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238229 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238230 | freepbxuser | localhost | asterisk | Sleep | 143 | | NULL | 0.000 |
| 238258 | root | localhost | NULL | Query | 0 | NULL | show processlist | 0.000 |
±-------±------------±----------------±--------------±--------±-----±------±-----------------±---------+
152 rows in set (0.00 sec)

MariaDB [(none)]>

No max_connections in /etc/my.cnf, so default 100. Should be enough anyway. Even, if I set to to 200, I guess the error will not vanish.

The problem ALWAYS happens when receiving text messages.

As Preston mentioned. /vax is odd, you should look into this, unless it was a typo…

There is something on your PBX that keeps on opening a MySQL connection and does not close it, or perhaps it tries to close a different connection.

You mentioned SMS, is this through the SMS module? Can you elaborate what makes you think so? I have no idea how the Sangoma SMS works, if it gets processed through the Asterisk dialplan then you should be able to grab a call trace and post it here via pastebin.

Do you have any custom dialplans or scripts on your PBX?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.