Summary | Unable to parse recurring events during iCalendar import |
Queue | Kronolith |
Queue Version | 4.1.3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | wrcdrijfhout (at) imperamus (dot) eu |
Created | 10/28/2013 (4304 days ago) |
Due | |
Updated | 11/03/2013 (4298 days ago) |
Assigned | |
Resolved | 10/29/2013 (4303 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
`
handling died prematurely.
I will contact Jan via e-mail about a larger ICS-file with which the
problem can be reproduced.
the other ICS file.
committed. The problem persists; I traced it to an OutOfMemory-problem:
In kronolith/lib/Api.php, line 896 onward, I wrote:
`$i=-1;
foreach ($events as $dayevents) {
print(++$i.'<br/>');
print((memory_get_usage()/1024/1024).'MB / '. ini_get('memory_limit')
. '<br/>');
foreach ($dayevents as $event) {
$iCal->addComponent($event->toiCalendar($iCal));
}
}
die();
`
From this I deduced I exceeded the memory limit. I find it dubious
that experting a mere 100 calendar entries would require 184MB to
yield a 2.9MB file; can we optimize this?
In Icalendar.php, we can (at least) do this:
`
public function addComponent(&$components)
{
if (is_array($components)) {
foreach ($components as &$component) {
$this->addComponent($component);
}
} else if ($components instanceof Horde_Icalendar) {
$components->_container = &$this;
$this->_components[] = &$components;
}
}
`
Notice the ampersands; i.e., by-reference/address-of operator. The
line "$this->_components[] = &$component;" is still the most expensive
one. Anyhow, by replacing addComponent as such, we cut down memory
usage from 184MB to 53MB (and gain more performance as well)!
I recommend exploring further applications of passing values
by-reference (by using the &-operator) instead of by-value throughout
Horde (especially oft-used functions, like domain-entity functions).
-----------
Also, the previous fix for kronolith/lib/Event.php you added checks
for the Timezone-object being at index 0 or 1, but array_pop always
retrieves the object at the last index (rather than the non-Timezone
index). I suggest the following generalization:
`
foreach ($vEventException_r as $key => &$vEE){
if ($vEE instanceof Horde_Icalendar_Vtimezone){
unset($vEventException_r[$key]);
}
}
// This should never happen, but protect against
it anyway.
if (count($vEventException_r) > 1) {
throw new Kronolith_Exception(_("Unable to
parse event."));
}
$vEventException = array_pop($vEventException_r);
`
(
Bug #12801).* CalDAV counts 551 entries in its index, while the database and
source ICS-file contain 595 entries. Unless not all VEVENT-objects
should be in the index, there is still a problem here.
handling died prematurely.
I will contact Jan via e-mail about a larger ICS-file with which the
problem can be reproduced.
the other ICS file.
(
Bug #12801).* CalDAV counts 551 entries in its index, while the database and
source ICS-file contain 595 entries. Unless not all VEVENT-objects
should be in the index, there is still a problem here.
* The ICAL-URL is completely empty, supposedly because PHP's request
handling died prematurely.
I will contact Jan via e-mail about a larger ICS-file with which the
problem can be reproduced.
State ⇒ Resolved
commit ecd18ac4f04036cf6cede10be1c30c5d901edc5c
Author: Jan Schneider <jan@horde.org>
Date: Tue Oct 29 18:44:02 2013 +0100
[jan] Fix fatal error if recurrence exceptions have timezones set
(
Bug #12801).kronolith/docs/CHANGES | 1 +
kronolith/lib/Event.php | 5 ++++-
kronolith/package.xml | 4 ++--
3 files changed, 7 insertions(+), 3 deletions(-)
http://git.horde.org/horde-git/-/commit/ecd18ac4f04036cf6cede10be1c30c5d901edc5c
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Unable to parse recurring events during iCalendar import
Queue ⇒ Kronolith
Milestone ⇒
Patch ⇒ No
New Attachment: Hobby.ics
State ⇒ Unconfirmed