6.0.0-beta1
7/4/25

[#13439] Significant increase in used MySQL DB connections
Summary Significant increase in used MySQL DB connections
Queue Horde Base
Queue Version 5.2.1
Type Bug
State Resolved
Priority 1. Low
Owners slusarz (at) horde (dot) org
Requester mmarx (at) netdmon (dot) de
Created 08/13/2014 (3978 days ago)
Due
Updated 08/16/2014 (3975 days ago)
Assigned 08/15/2014 (3976 days ago)
Resolved 08/16/2014 (3975 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
08/16/2014 12:45:46 AM Michael Slusarz Comment #8
Assigned to Michael Slusarz
State ⇒ Resolved
Reply to this comment
Fixed.  Injector bootstrapping broke since we are now possibly using 
multiple different cache drivers in a single setup - there's no native 
way of handling bootstrapping injector dependencies in this situation 
(only supports a single injector that can be populated and passed to 
the child factory).
08/16/2014 12:44:33 AM Git Commit Comment #7 Reply to this comment
Changes have been made in Git (master):

commit d1e573ed0b67b1061497a93c14cd5fe4a7341f0c
Author: Michael M Slusarz <slusarz@horde.org>
Date:   Fri Aug 15 18:44:18 2014 -0600

     [mms] Fix boostrapping DB object when using SQL as the Horde 
cache driver (Bug #13439).

  framework/Core/lib/Horde/Core/Factory/Db.php |   43 +++++++++++++------------
  framework/Core/package.xml                   |    2 +
  2 files changed, 24 insertions(+), 21 deletions(-)

http://github.com/horde/horde/commit/d1e573ed0b67b1061497a93c14cd5fe4a7341f0c
08/15/2014 09:54:51 PM Michael Slusarz Comment #6
State ⇒ Assigned
Reply to this comment
Do NOT use SQL as a caching backend.
While 100% true, the log does indicate there is an issue with 
bootstrapping of the DB factory when SQL is being used as a cache:

  10. Horde_Core_Factory_Db->createDb() 
/usr/share/php/Horde/Core/Factory/Db.php:102
  11. Horde_Core_Factory_Cache->create() 
/usr/share/php/Horde/Core/Factory/Db.php:179
  12. Horde_Core_Factory_Db->create() 
/usr/share/php/Horde/Core/Factory/Cache.php:81
  13. Horde_Core_Factory_Db->create() 
/usr/share/php/Horde/Core/Factory/Db.php:99
  14. Horde_Core_Factory_Db->createDb() 
/usr/share/php/Horde/Core/Factory/Db.php:102
  15. Horde_Core_Factory_Cache->create() 
/usr/share/php/Horde/Core/Factory/Db.php:179
  16. Horde_Core_Factory_Db->create() 
/usr/share/php/Horde/Core/Factory/Cache.php:81
  17. Horde_Core_Factory_Db->create() 
/usr/share/php/Horde/Core/Factory/Db.php:99
  18. Horde_Core_Factory_Db->createDb() 
/usr/share/php/Horde/Core/Factory/Db.php:102
[etc.]

So that needs to be fixed.
08/15/2014 09:00:31 PM mmarx (at) netdmon (dot) de Comment #5 Reply to this comment
Hi Jan,

thanks for the reply, I guess it's been a while since I looked into 
the Caching settings tab because I cannot remember to have ever seen 
the "SQL-based cache storage (NOT RECOMMENDED)", especially the "not 
recommended" part in there. ;-)

Thanks

Matthias Marx
08/15/2014 08:10:28 PM Jan Schneider Comment #4
State ⇒ Not A Bug
Reply to this comment
Do NOT use SQL as a caching backend.
08/15/2014 06:52:09 PM mmarx (at) netdmon (dot) de Comment #3
New Attachment: 2014-08-15_horde_sql_debug_horde5.2.1.txt Download
Reply to this comment
This time I only upgraded horde not the other applications.

$ pear upgrade -a -B horde/horde
...
upgrade ok: channel://pear.horde.org/Horde_Date-2.0.12
upgrade ok: channel://pear.horde.org/Horde_Util-2.5.1
upgrade ok: channel://pear.horde.org/Horde_Compress_Fast-1.0.3
upgrade ok: channel://pear.horde.org/Horde_CssMinify-1.0.1
upgrade ok: channel://pear.horde.org/Horde_HashTable-1.2.0
upgrade ok: channel://pear.horde.org/horde_lz4-1.0.6
upgrade ok: channel://pear.horde.org/Horde_Mime-2.4.4
upgrade ok: channel://pear.horde.org/Horde_OpenXchange-1.0.0
upgrade ok: channel://pear.horde.org/Horde_SyncMl-2.0.4
upgrade ok: channel://pear.horde.org/Horde_JavascriptMinify-1.1.0
upgrade ok: channel://pear.horde.org/Horde_Core-2.13.0
upgrade ok: channel://pear.horde.org/Horde_Mail-2.4.0
upgrade ok: channel://pear.horde.org/Horde_ActiveSync-2.17.0
upgrade ok: channel://pear.horde.org/Horde_JavascriptMinify_Jsmin-1.0.1
upgrade ok: channel://pear.horde.org/horde-5.2.1
upgrade ok: channel://pear.horde.org/Horde_Imap_Client-2.24.2
upgrade ok: channel://pear.horde.org/Horde_Smtp-1.6.0

The upgrade went fine, so I enabled debugging
  $conf['log']['priority'] = 'DEBUG';

and accessed the horde start page. The resulting log entries you can 
find in the attached file 2014-08-15_horde_sql_debug_horde5.2.1.txt

I added some comment lines what I did and prefixed them with "### mmarx:"

I think there is some kind of loop, see the end of the log.

Thanks for looking into this

Matthias Marx
08/15/2014 05:49:36 AM Michael Slusarz Comment #2
State ⇒ Feedback
Priority ⇒ 1. Low
Reply to this comment
Use Horde DEBUG logging to determine which SQL statements are causing 
the load.
08/13/2014 06:30:17 PM mmarx (at) netdmon (dot) de Comment #1
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Base
Summary ⇒ Significant increase in used MySQL DB connections
Type ⇒ Bug
Priority ⇒ 2. Medium
Reply to this comment
Hello Horde Team,

I upgraded horde to the latest stable release (5.2.1) via pear and ran 
into MySQL connections troubles. I was unable to login to horde, I 
just got the following errors. See below from which version I upgraded.

---- MySQL connection errors ----
WARN: HORDE [horde] PHP ERROR: mysqli::mysqli(): (HY000/2002): Can't 
connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (12) [pid 13963 on line 130 of 
"/usr/share/php/Horde/Db/Adapter/Mysqli.php"]
EMERG: HORDE [horde] Connect failed: (2002) Can't connect to local 
MySQL server through socket '/var/run/mysqld/mysqld.sock' (12) [pid 
9650 on line 133 of "/usr/share/php/Horde/Db/Adapter/Mysqli.php"]
WARN: HORDE [horde] PHP ERROR: mysqli::mysqli(): (HY000/1040): Too 
many connections [pid 13963 on line 130 of 
"/usr/share/php/Horde/Db/Adapter/Mysqli.php"]
EMERG: HORDE [horde] Connect failed: (1040) Too many connections [pid 
13963 on line 133 of "/usr/share/php/Horde/Db/Adapter/Mysqli.php"]
---------------------------------

After my first attempt of an upgrade I got "Out of Memory" errors, I'm 
using a small vhost to host my very small horde installation and 
therefore it hasn't really much memory. I fixed the OoM error by 
limiting MySQL to "max_connections=70", default value was 100 before.
I figured out that the new horde version uses a lot more database 
connections which basically breaks my system. I downgraded the horde 
installation back to 5.1.6, including all the previous versions of all 
packages, and it's working fine again. I have around 8-10 connections 
to my MySQL database by other applications, so with horde 5.1.6 I 
estimate that only 2-10 mysql connections are used while in 5.2.1 
there are already over 80 connections used just by accessing the login 
page. But it looks like those more than 80 connections are 
simultaneously and very short lived because I was unable to catch them 
with "mysql> show processlist;".

---- Horde 5.1.6 ----
mysql> show status like '%connections%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Connections          | 724   |
| Max_used_connections | 14    |
+----------------------+-------+
----------------------------

---- After the upgrade to 5.2.1 ------
mysql> show status like '%connections%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Connections          | 608   |
| Max_used_connections | 71    |   <- hits the max_connections limit
+----------------------+-------+
----------------------------

---- upgrades ----
PEAR.HORDE.ORG AVAILABLE UPGRADES (STABLE):
===========================================
CHANNEL        PACKAGE             LOCAL           REMOTE          SIZE
pear.horde.org Horde_ActiveSync    2.16.9 (stable) 2.17.0 (stable) 229kB
pear.horde.org Horde_Compress_Fast 1.0.2 (stable)  1.0.3 (stable)  12.2kB
pear.horde.org Horde_Core          2.11.2 (stable) 2.13.0 (stable) 1587kB
pear.horde.org Horde_Date          2.0.11 (stable) 2.0.12 (stable) 67kB
pear.horde.org Horde_HashTable     1.1.3 (stable)  1.2.0 (stable)  15.5kB
pear.horde.org Horde_Imap_Client   2.23.1 (stable) 2.24.2 (stable) 213kB
pear.horde.org Horde_Mail          2.3.0 (stable)  2.4.0 (stable)  31kB
pear.horde.org Horde_Mime          2.4.2 (stable)  2.4.4 (stable)  94kB
pear.horde.org Horde_Smtp          1.5.2 (stable)  1.6.0 (stable)  28kB
pear.horde.org Horde_SyncMl        2.0.3 (stable)  2.0.4 (stable)  132kB
pear.horde.org Horde_Util          2.4.0 (stable)  2.5.0 (stable)  35kB
pear.horde.org horde               5.1.6 (stable)  5.2.1 (stable)  2743kB
pear.horde.org imp                 6.1.7 (stable)  6.2.1 (stable)  4796kB
pear.horde.org ingo                3.1.4 (stable)  3.2.0 (stable)  1439kB
pear.horde.org kronolith           4.1.5 (stable)  4.2.1 (stable)  2501kB
pear.horde.org mnemo               4.1.3 (stable)  4.2.1 (stable)  1167kB
pear.horde.org nag                 4.1.4 (stable)  4.2.1 (stable)  1598kB
pear.horde.org trean               1.0.3 (stable)  1.1.1 (stable)  579kB
pear.horde.org turba               4.1.4 (stable)  4.2.1 (stable)  1896kB
------------------

Tell me if you need further information, but I'm currently reluctant 
to upgrade to 5.2.1 again because then horde is completely broken.

Kind Regards

Matthias Marx

Saved Queries