6.0.0-beta1
7/12/25

[#14453] Allowed memory size exhausted
Summary Allowed memory size exhausted
Queue Kronolith
Queue Version 4.2.17
Type Bug
State Resolved
Priority 2. Medium
Owners mrubinsk (at) horde (dot) org
Requester lukas.weiss (at) raiffeisen (dot) it
Created 08/24/2016 (3244 days ago)
Due
Updated 10/19/2020 (1727 days ago)
Assigned 08/25/2016 (3243 days ago)
Resolved 08/27/2016 (3241 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
10/19/2020 01:47:27 PM docmax (at) docmax (dot) my (dot) to Comment #27 Reply to this comment
Same issue here now
10/20/2017 08:34:39 PM Git Commit Comment #26 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 4c18212c3b61d81486f2a9243f649eababa347ed
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat, 27 Aug 2016 11:09:54 -0400

Take 2 on fix for Bug #14453

  M lib/Kronolith.php

https://github.com/horde/kronolith/commit/4c18212c3b61d81486f2a9243f649eababa347ed
10/20/2017 08:34:38 PM Git Commit Comment #25 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 9cc4afae289ef81e3d075eb9510d4d909e91cbf9
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat, 27 Aug 2016 11:08:35 -0400

Revert "Revert "Bug: 14453 Limit addCoverDates to the $endDate.""

This reverts commit 31e24657b1a79406be6ed7f4c60bb1a595cda0a5.

  M lib/Kronolith.php

https://github.com/horde/kronolith/commit/9cc4afae289ef81e3d075eb9510d4d909e91cbf9
10/20/2017 08:34:38 PM Git Commit Comment #24 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 8ab1e13477340cb5d28eeda0f2d4aabee3b47744
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri, 26 Aug 2016 12:50:20 -0400

Revert "Bug: 14453 Limit addCoverDates to the $endDate."

This reverts commit 81d537938065067860038a8f2186e0207c134235.

  M lib/Kronolith.php

https://github.com/horde/kronolith/commit/8ab1e13477340cb5d28eeda0f2d4aabee3b47744
10/20/2017 08:34:37 PM Git Commit Comment #23 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit f3688a15361ed1a1dc3b039b485a9532f0fbcfc7
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed, 24 Aug 2016 22:38:42 -0400

Bug: 14453 Limit addCoverDates to the $endDate.

Prevents memory issues, or looping unnecessarily for extremely
long events.

  M lib/Kronolith.php

https://github.com/horde/kronolith/commit/f3688a15361ed1a1dc3b039b485a9532f0fbcfc7
08/29/2016 07:16:44 AM lukas (dot) weiss (at) raiffeisen (dot) it Comment #22 Reply to this comment
Thank you, it is working now!
08/27/2016 03:38:30 PM Michael Rubinsky Comment #21
State ⇒ Resolved
Reply to this comment
Fixed, for real, for Kronolith 4.2.18
08/27/2016 03:36:31 PM Git Commit Comment #20 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit d39dd96177af4438529f9fe6b3df0a27ce6c5c74
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Aug 27 11:09:54 2016 -0400

     Take 2 on fix for Bug #14453

  kronolith/lib/Kronolith.php | 10 ++++++++++
  1 file changed, 10 insertions(+)

http://github.com/horde/horde/commit/d39dd96177af4438529f9fe6b3df0a27ce6c5c74
08/27/2016 03:36:30 PM Git Commit Comment #19 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 3caff29bf91b5a72e0a7e753ed3198c03648a692
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Aug 27 11:08:35 2016 -0400

     Revert "Revert "Bug: 14453 Limit addCoverDates to the $endDate.""

     This reverts commit 31e24657b1a79406be6ed7f4c60bb1a595cda0a5.

  kronolith/lib/Kronolith.php | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)

http://github.com/horde/horde/commit/3caff29bf91b5a72e0a7e753ed3198c03648a692
08/27/2016 03:18:53 PM Git Commit Comment #18 Reply to this comment
Changes have been made in Git (master):

commit 89d229a30bcda9f01250ae7cbac0f5f57ef9fdfc
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Aug 27 11:04:14 2016 -0400

     Take 2 on fix for Bug: 14453.

  kronolith/lib/Kronolith.php | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

http://github.com/horde/horde/commit/89d229a30bcda9f01250ae7cbac0f5f57ef9fdfc
08/27/2016 03:18:51 PM Git Commit Comment #17 Reply to this comment
Changes have been made in Git (master):

commit 0f9a27ac7bcdc6de7780dabd25dbcf0b229d386d
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sat Aug 27 10:47:51 2016 -0400

     Revert "Revert "Bug: 14453 Limit addCoverDates to the $endDate.""

     This reverts commit 4bd7428e438a50537882c70e1a71f90a963ff856.

  kronolith/lib/Kronolith.php | 14 ++++++++------
  1 file changed, 8 insertions(+), 6 deletions(-)

http://github.com/horde/horde/commit/0f9a27ac7bcdc6de7780dabd25dbcf0b229d386d
08/26/2016 04:50:28 PM Git Commit Comment #16 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 31e24657b1a79406be6ed7f4c60bb1a595cda0a5
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri Aug 26 12:50:20 2016 -0400

     Revert "Bug: 14453 Limit addCoverDates to the $endDate."

     This reverts commit 81d537938065067860038a8f2186e0207c134235.

  kronolith/lib/Kronolith.php | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)

http://github.com/horde/horde/commit/31e24657b1a79406be6ed7f4c60bb1a595cda0a5
08/26/2016 04:49:42 PM Git Commit Comment #15 Reply to this comment
Changes have been made in Git (master):

commit 4bd7428e438a50537882c70e1a71f90a963ff856
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Fri Aug 26 12:44:23 2016 -0400

     Revert "Bug: 14453 Limit addCoverDates to the $endDate."

     This reverts commit 7695fc444ff10bd9950f0332c27c5c5874397d0a.

     This isn't correct. Setting $endDate to $event->end defeats the purpsose
     of this change when polling for alarms but removing that line
     will no longer return multi-day events that start before $startDate
     when no $endDate is provided.

     Not sure what the solution is here since when polling alarms we
     don't want an end date - no way of knowing the longest alarm interval
     that we have.

     Perhaps always limiting to some unrealistic time frame like 10 years
     would be sufficient for protecting against memory limits while still
     allowing reasonable alarm intervals to be supported?

  kronolith/lib/Kronolith.php | 14 ++++++--------
  1 file changed, 6 insertions(+), 8 deletions(-)

http://github.com/horde/horde/commit/4bd7428e438a50537882c70e1a71f90a963ff856
08/26/2016 04:43:18 PM Michael Rubinsky Comment #14 Reply to this comment
Actually, this isn't the correct fix anyway. It actually breaks 
coverEvents in certain cases (like when a multiday event starts before 
$startDate) so in certain cases alarms would be missed.
08/26/2016 02:36:31 PM Michael Rubinsky Comment #13 Reply to this comment
I don't think it is resolved for when an alarm is set.

In the Kronolith_Driver_Sql::listAlarms, listEvents is called 
without an endDate parameter... Then in 
Kronolith_Driver_Sql::_listEvents, addEvents is called without this 
parameter too. So the loop doesn't stop before the original event's 
end date...
The reason this works is because if no $endDate is passed to 
addEvents, then the check $loopDate->compareDateTime($endDate) returns 
false, thus breaking the loop.

I still can't get the stable code (FRAMEWORK_5_2) to break with this 
patch. However, I AM having problems with the git master code at the 
moment.

08/25/2016 03:18:39 PM Michael Rubinsky Comment #12 Reply to this comment
I tried to create a new event from 1900 to 2800 with an alarm set... 
it immediately shows me the reminder popup and if I switch to trean 
(without dismissing the alarm), everything is working...
but then, if I don't dismiss the popup, logout and relogin i get the 
same error as described before. maybe you can try this too?
This is exactly what I had to do to originally reproduce the problem 
in the first place. I'll look later tonight or tomorrow regarding that 
code path.

08/25/2016 02:40:04 PM lukas (dot) weiss (at) raiffeisen (dot) it Comment #11 Reply to this comment
I'll try it with the code from the master branch...
My tests were done on FRAMEWORK_5_2 as well (that's where the 
screenshot is from). Unless you are running a git checkout, that is. 
There were too many changes to that code to cherry-pick from master 
to FW_52.

So, it is still failing for you with the FW_52 patches?
I applied the changes you made in your last commit.

I tried to create a new event from 1900 to 2800 with an alarm set... 
it immediately shows me the reminder popup and if I switch to trean 
(without dismissing the alarm), everything is working...
but then, if I don't dismiss the popup, logout and relogin i get the 
same error as described before. maybe you can try this too?

i will have a look tomorrow again... thanks for your help.
08/25/2016 02:29:01 PM Michael Rubinsky Comment #10 Reply to this comment
I'll try it with the code from the master branch...
My tests were done on FRAMEWORK_5_2 as well (that's where the 
screenshot is from). Unless you are running a git checkout, that is. 
There were too many changes to that code to cherry-pick from master to 
FW_52.

So, it is still failing for you with the FW_52 patches?
08/25/2016 01:59:25 PM lukas (dot) weiss (at) raiffeisen (dot) it Comment #9 Reply to this comment
I'll try it with the code from the master branch...
08/25/2016 01:32:58 PM Michael Rubinsky Comment #8
State ⇒ Assigned
New Attachment: image.jpeg Download
Reply to this comment
Have you tested the patch? I tested with an alarm set, with the event 
start/end you provided. It works with this patch, does not work 
without it. Screenshot attached. I will look further into the code 
path you are talking about, but your original issue seems to be 
resolved locally.
08/25/2016 07:03:31 AM lukas (dot) weiss (at) raiffeisen (dot) it Comment #7 Reply to this comment
I don't think it is resolved for when an alarm is set.

In the Kronolith_Driver_Sql::listAlarms, listEvents is called without 
an endDate parameter... Then in Kronolith_Driver_Sql::_listEvents, 
addEvents is called without this parameter too. So the loop doesn't 
stop before the original event's end date...

Here's the stack trace (e.g. calling trean at the beginning):
#0  Kronolith::addEvents() called at 
[/usr/share/nginx/www/kronolith/lib/Driver/Sql.php:312]
#1  Kronolith_Driver_Sql->_listEvents() called at 
[/usr/share/nginx/www/kronolith/lib/Driver.php:310]
#2  Kronolith_Driver->listEvents() called at 
[/usr/share/nginx/www/kronolith/lib/Driver/Sql.php:82]
#3  Kronolith_Driver_Sql->listAlarms() called at 
[/usr/share/nginx/www/kronolith/lib/Kronolith.php:120]
#4  Kronolith::listAlarms() called at 
[/usr/share/nginx/www/kronolith/lib/Application.php:492]
#5  Kronolith_Application->listAlarms()
#6  call_user_func_array() called at [/usr/share/php/Horde/Registry.php:1196]
#7  Horde_Registry->callAppMethod() called at 
[/usr/share/php/Horde/Core/Factory/Alarm.php:170]
#8  Horde_Core_Factory_Alarm->load()
#9  call_user_func() called at [/usr/share/php/Horde/Alarm.php:113]
#10 Horde_Alarm->listAlarms() called at [/usr/share/php/Horde/Alarm.php:431]
#11 Horde_Alarm->notify() called at 
[/usr/share/php/Horde/Notification/Handler/Decorator/Alarm.php:63]
#12 Horde_Notification_Handler_Decorator_Alarm->notify() called at 
[/usr/share/php/Horde/Notification/Handler.php:323]
#13 Horde_Notification_Handler->notify() called at 
[/usr/share/php/Horde/Core/Notification/Handler.php:49]
#14 Horde_Core_Notification_Handler->notify() called at 
[/usr/share/nginx/www/trean/add.php:81]
#15 require(/usr/share/nginx/www/trean/add.php) called at 
[/usr/share/nginx/www/trean/browse.php:19]
#16 require(/usr/share/nginx/www/trean/browse.php) called at 
[/usr/share/nginx/www/trean/index.php:11]

08/25/2016 02:45:42 AM Michael Rubinsky State ⇒ Resolved
 
08/25/2016 02:45:35 AM Michael Rubinsky Comment #6
Assigned to Michael Rubinsky
Reply to this comment
Fixed for Kronolith 4.2.18.
08/25/2016 02:44:34 AM Git Commit Comment #5 Reply to this comment
Changes have been made in Git (master):

commit 7695fc444ff10bd9950f0332c27c5c5874397d0a
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Aug 24 22:44:16 2016 -0400

     Bug: 14453 Limit addCoverDates to the $endDate.

  kronolith/lib/Kronolith.php | 14 ++++++++------
  1 file changed, 8 insertions(+), 6 deletions(-)

http://github.com/horde/horde/commit/7695fc444ff10bd9950f0332c27c5c5874397d0a
08/25/2016 02:42:12 AM Git Commit Comment #4 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_2):

commit 81d537938065067860038a8f2186e0207c134235
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Wed Aug 24 22:38:42 2016 -0400

     Bug: 14453 Limit addCoverDates to the $endDate.

     Prevents memory issues, or looping unnecessarily for extremely
     long events.

  kronolith/lib/Kronolith.php | 14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)

http://github.com/horde/horde/commit/81d537938065067860038a8f2186e0207c134235
08/24/2016 02:36:42 PM lukas (dot) weiss (at) raiffeisen (dot) it Comment #3 Reply to this comment
Thank you.

I logged $eventStart and $eventEnd before the loop, which was from 
2016 to 2800.
08/24/2016 02:22:49 PM Michael Rubinsky Comment #2 Reply to this comment
I found the problem is the while-loop at the end of the 
Kronolith::addEvents function ($loopDate), which iterates through 
every day of the event causing the memory failure.
That loop *should* only be looping up until $endDate, which *should* 
be the end of the time period we need to load (I.e., one month for the 
month view etc...). Perhaps this isn't working correctly. I"ll take a 
look when I'm back in my office.


08/24/2016 02:17:02 PM lukas (dot) weiss (at) raiffeisen (dot) it Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ Allowed memory size exhausted
Type ⇒ Bug
Queue ⇒ Kronolith
Reply to this comment
hi,

I got an error saying the allowed memory size of 512 mb was exhausted.
after some debugging I found a user which somehow created an event 
from 0900-02-03 12:00:00 to 2800-02-04 13:00:00 with an alarm.
this prevented horde from being loaded, no matter if Kronolith or 
Trean was opened, because the alarms are loaded every time.

I found the problem is the while-loop at the end of the 
Kronolith::addEvents function ($loopDate), which iterates through 
every day of the event causing the memory failure.

Is it possible to stop the loop at some point to prevent this error?
Thanks

Saved Queries