[Tickets #8671] Nag::listAlarms fails when called from the scritps/alarms.php cron job

View: New views
6 Messages — Rating Filter:   Alert me  

[Tickets #8671] Nag::listAlarms fails when called from the scritps/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Created By         | Valentin.Vidic@...
  Summary            | Nag::listAlarms fails when called from the
                     | scritps/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
  State              | Unconfirmed
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


Valentin.Vidic@... (2009-11-02 10:49) wrote:

The cron job that should trigger scheduled alarms constantly fails  
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?





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...

[Tickets #8671] Re: Nag::listAlarms fails when called from the scritps/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Updated By         | Valentin.Vidic@...
  Summary            | Nag::listAlarms fails when called from the
                     | scritps/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
  State              | Unconfirmed
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
+New Attachment     | nag.diff
------------------------------------------------------------------------------


Valentin.Vidic@... (2009-11-02 11:09) wrote:

It seems that using factory instead of singleton when $tasklist is set  
helps. Patch attached.





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...

[Tickets #8671] Re: Nag::listAlarms fails when called from the scripts/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Updated By         | Jan Schneider <jan@...>
-Summary            | Nag::listAlarms fails when called from the
                     | scritps/alarms.php cron job
+Summary            | Nag::listAlarms fails when called from the
                     | scripts/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
-State              | Unconfirmed
+State              | Feedback
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


Jan Schneider <jan@...> (2009-11-07 08:26) wrote:

That doesn't make any sense because we use DB::connect() in the SQL  
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.





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...

[Tickets #8671] Re: Nag::listAlarms fails when called from the scripts/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Updated By         | Valentin.Vidic@...
  Summary            | Nag::listAlarms fails when called from the
                     | scripts/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
  State              | Feedback
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


Valentin.Vidic@... (2009-11-12 11:03) wrote:

> That doesn't make any sense because we use DB::connect() in the SQL  
> 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.

I added a print statement to connect and disconnect functions in  
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.





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...

[Tickets #8671] Re: Nag::listAlarms fails when called from the scripts/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Updated By         | Jan Schneider <jan@...>
  Summary            | Nag::listAlarms fails when called from the
                     | scripts/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
  State              | Feedback
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


Jan Schneider <jan@...> (2009-11-12 11:36) wrote:

DB::connect() is a singleton. Even if we create many Nag_Driver  
instances, DB::connect() should always return the same DB instance,  
and thus only use one db connection.





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...

[Tickets #8671] Re: Nag::listAlarms fails when called from the scripts/alarms.php cron job

by bugs-14 :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8671
------------------------------------------------------------------------------
  Ticket             | 8671
  Updated By         | Valentin.Vidic@...
  Summary            | Nag::listAlarms fails when called from the
                     | scripts/alarms.php cron job
  Queue              | Nag
  Version            | 2.3.3
  Type               | Bug
  State              | Feedback
  Priority           | 2. Medium
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


Valentin.Vidic@... (2009-11-12 11:50) wrote:

> DB::connect() is a singleton. Even if we create many Nag_Driver  
> instances, DB::connect() should always return the same DB instance,  
> and thus only use one db connection.

I can't find any singleton functionality in DB.php. Perhaps you are  
talking about MDB2, but nag is still using the old DB interface.





--
You are subscribed to this list as: lists@...
To unsubscribe, mail: bugs-unsubscribe@...