Summary | Nag::listAlarms fails when called from the scripts/alarms.php cron job |
Queue | Nag |
Queue Version | 2.3.3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | |
Requester | Valentin.Vidic (at) carnet (dot) hr |
Created | 11/02/2009 (5737 days ago) |
Due | |
Updated | 02/20/2011 (5262 days ago) |
Assigned | 02/20/2011 (5262 days ago) |
Resolved | 02/20/2011 (5262 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Taken from
State ⇒ Resolved
State ⇒ Assigned
(which I'm guessing helps because the object isn't cached), we should
probably cache the DB object so we don't need to keep recreating it.
This will be moot for Horde 4, though which will use Horde_Db.
instances, DB::connect() should always return the same DB instance,
and thus only use one db connection.
talking about MDB2, but nag is still using the old DB interface.
instances, DB::connect() should always return the same DB instance,
and thus only use one db connection.
driver which already is a singleton. Besides that we only have a
single DB instance, the DB package also takes care of re-using open
database connections.
DB/mysqli.php and called alarm cron job. It looks like DB connect
get's called 2071 times (mostly from nag) without a single disconnect.
And I would expect this as Nag::listAlarms gets called with a list of
~2000 users and for each user it calls Nag_Driver::singleton($user).
Since the $user is part of the instance signature, it creates a new
Nag_Driver_sql instance for each user. And I don't see it trying to
reuse existing connections in DB.php or DB/mysqli.php. I think you can
reproduce this just by creating kronolith and nag alarms for a large
number of users.
State ⇒ Feedback
Summary ⇒ Nag::listAlarms fails when called from the scripts/alarms.php cron job
driver which already is a singleton. Besides that we only have a
single DB instance, the DB package also takes care of re-using open
database connections.
New Attachment: nag.diff
helps. Patch attached.
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ Nag
Summary ⇒ Nag::listAlarms fails when called from the scritps/alarms.php cron job
Type ⇒ Bug
with this error:
Nov 02 16:32:32 HORDE [error] [nag] The Tasks backend is not currently
available: DB Error: connect failed [pid 19885 on line 228 of
"/srv/webmail/www/lib/Horde/Alarm.php"]
It seems the problem is in the call to Nag::listAlarms. This function
creates a new database connection for each storage instance and after
a few hundred users database returns the error 'Too many connections'.
Perhaps a single database connection could be used or old connections
can be closed?