Too Many Connections Error

Discussion in 'Server Operation' started by Gregory S Tibbetts, Jul 31, 2018.

  1. I just migrated a server from Plesk to ispconfig 3.1. I pointed the dns at the newserverandgotthe follwoing erro when pointing the browser at my webmail.

    A fatal error has occurred
    Could not instantiate PDO with DSN "mysql:protocol=unix;unix_socket=/var/lib/mysql/mysql.sock;dbname=horde". PDOException: SQLSTATE[HY000] [1040] Too many connections
    Details have been logged for the administrator.

    I checked for the number of connections onthe server andthere were 450. How? It had 450 connections afterI pointed the dns back atthe old server. Basically any of the sites that have a database are unreachable. Can anyone help?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Set the max_connections and max_user_connections values in MySQL my.cnf to a higher value, then restart MySQL.
     
  3. For some odd reason I have over 9,000 connections to my mysql server. I am wondering how the number is so high. I ran the command

    MariaDB [(none)]> show processlist;
    +------+------+-----------+------+---------+------+-------+------------------+----------+
    | Id | User | Host | db | Command | Time | State | Info | Progress |
    +------+------+-----------+------+---------+------+-------+------------------+----------+
    | 9385 | root | localhost | NULL | Query | 0 | NULL | show processlist | 0.000 |
    +------+------+-----------+------+---------+------+-------+------------------+----------+
    1 row in set (0.00 sec)

    Then I rebooted the server. Here are my connections after a reboot. Is there a hack that hackers do that can cause this? I have a pretty shut down firewall so I am pretty sure I don'thave a hacker in. Although the server I migrated from may have had one and suddenly started getting the same problem.
     
  4. my max_user_connections is set to 0. I went into the my.cnf file and there are no setting for max_connections or max_user_connections. Why is it set to 0?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The first column is the process ID, not the total number of processes. Actually, the above output means that there is currently 1 process and not over 9000.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    and if you want to get the count of active connections, you can also use the query:

    Code:
    show status where `variable_name` = 'Threads_connected';
     
  7. ztk.me

    ztk.me ISPConfig Developer ISPConfig Developer

    450 however doesn't seem to be a process id, so this could be an acutal figure.

    Either you really have that much concurrent connections or your connections are open for too long cause too slow response => stacking up
    if you use php applications ... I remember some smart ass guy studying IT saying: use persistance connections so you don't need to open them over and over again.... yeah I think he never got why this is fatal on apache/php - make sure there are not much "sleeping" idleing processes, it may be a sign for pconnects.
     
  8. It was the number of connections in mysql.
     
  9. The thing I am concerned about is this. I just migrated this ISP Config server from a Plesk server. The sites are not live yet because I am having a MySQL issue. And for some reason right when I started doing the migration my Plesk server got the same MySQL problem. It did not have this problem before. I also had a problem where someone changed passwords in the Plesk server and it was not me. I suspect a hacker in the Plesk server but am not sure. At the same as this mysql problem started in the Plesk server it started in the ISPConfig server. I can't put this new ISP Config server into production until I am able to fix the probelm of for some reason the root user has thousands of database connections open. When this is happening I can still access the ISP Config control panel, but not user sites if they have a database. Please help.
     
  10. Is there a way to tell which script on the server is using these connections?
     
  11. Taleman

    Taleman Well-Known Member HowtoForge Supporter

Share This Page