Page MenuHomePhorge

kolab 16.1 roundcube webmail calendar internal server error parsing time string
Closed, ResolvedPublic

Description

User complained about getting 500 internal server error when trying to cancel some already accepted calendar entry in kolab 16.1 roundcube webmail calendar app. This is what I see in /var/log/roundcubemail/errors logfile:

[18-Mar-2017 11:00:24 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::construct(): Failed to parse time string (Tue Mar 21 2017 11:00:00 GMT+0200 (FLE Standard Time)) at position 39 (S): Double timezone specification' in /usr/share/roundcubemail/plugins/calendar/calendar.php:1978
Stack trace:
#0 /usr/share/roundcubemail/plugins/calendar/calendar.php(1978): DateTime->
construct('Tue Mar 21 2017...', Object(DateTimeZone))
#1 /usr/share/roundcubemail/plugins/calendar/calendar.php(1016): calendar->write_preprocess(Array, 'edit')
#2 [internal function]: calendar->event_action()
#3 /usr/share/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php(491): call_user_func(Array)
#4 /usr/share/roundcubemail/index.php(283): rcube_plugin_api->exec_action('calendar.event')
#5 /usr/share/roundcubemail/public_html/index.php(26): include('/usr/share/roun...')
#6 {main}

thrown in /usr/share/roundcubemail/plugins/calendar/calendar.php on line 1978

[18-Mar-2017 11:05:31 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::construct(): Failed to parse time string (Tue Mar 21 2017 11:00:00 GMT+0200 (FLE Standard Time)) at position 39 (S): Double timezone specification' in /usr/share/roundcubemail/plugins/calendar/calendar.php:1978
Stack trace:
#0 /usr/share/roundcubemail/plugins/calendar/calendar.php(1978): DateTime->
construct('Tue Mar 21 2017...', Object(DateTimeZone))
#1 /usr/share/roundcubemail/plugins/calendar/calendar.php(1016): calendar->write_preprocess(Array, 'edit')
#2 [internal function]: calendar->event_action()
#3 /usr/share/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php(491): call_user_func(Array)
#4 /usr/share/roundcubemail/index.php(283): rcube_plugin_api->exec_action('calendar.event')
#5 /usr/share/roundcubemail/public_html/index.php(26): include('/usr/share/roun...')
#6 {main}

thrown in /usr/share/roundcubemail/plugins/calendar/calendar.php on line 1978

versions used:
roundcubemail-plugin-calendar-3.3-5.1.el7.kolab_16.noarch
roundcubemail-plugin-libcalendaring-assets-3.3-5.1.el7.kolab_16.noarch
roundcubemail-1.2.3-3.1.el7.kolab_16.noarch
pykolab-0.8.7-1.1.el7.kolab_16.noarch
libkolab-2.0-1.11.el7.kolab_16.x86_64
php-5.4.16-42.el7.x86_64

Details

Ticket Type
Task

Event Timeline

Just in case, more rpm versions:

roundcubemail-plugins-kolab-3.3-5.1.el7.kolab_16.noarch
roundcubemail-plugin-libkolab-3.3-5.1.el7.kolab_16.noarch

Is there a chance we can see the original event data in XML form or as iCal export? Anyway, I suppose a needed fix here will be to remove the timezone string in brackets before passing it to the DateTime constructor.

Which parts of the XML are important? I can try to find it..

The best would be to see the whole message. You can remove private data.

Sorry took a while, but now it happened again..:

[23-May-2017 18:51:50 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::construct(): Failed to parse time string (Wed May 24 2017 09:00:00 GMT+0300 (FLE Daylight Time)) at position 39 (D): Double timezone specification' in /usr/share/roundcubemail/plugins/calendar/calendar.php:1978
Stack trace:
#0 /usr/share/roundcubemail/plugins/calendar/calendar.php(1978): DateTime->
construct('Wed May 24 2017...', Object(DateTimeZone))
#1 /usr/share/roundcubemail/plugins/calendar/calendar.php(1016): calendar->write_preprocess(Array, 'edit')
#2 [internal function]: calendar->event_action()
#3 /usr/share/roundcubemail/program/lib/Roundcube/rcube_plugin_api.php(491): call_user_func(Array)
#4 /usr/share/roundcubemail/index.php(283): rcube_plugin_api->exec_action('calendar.event')
#5 /usr/share/roundcubemail/public_html/index.php(26): include('/usr/share/roun...')
#6 {main}

thrown in /usr/share/roundcubemail/plugins/calendar/calendar.php on line 1978

Here's (a slightly modified / private data removed) .ics that caused the error above:
http://pasik.reaktio.net/kolab-webmail-calendar-internal-server-error.ics

I can't reproduce the issue by importing the .ics file. Could you provide the object in xml format (i.e. the message from imap folder)?

I hope I didn't screw up the xml while removing private info.. but here goes:
http://pasik.reaktio.net/kolab-webmail-calendar-internal-server-error.xml

But this object has valid dates. So, how do I reproduce the issue?

That's the problem. The error in question hasn't happened to me, so i don't know the exact steps to reproduce. What I've heard is that "it just happens automatically". When the recipient gets the calendar invitation email, the placeholder event is automatically created in the calendar (per kolab policy settings), and when the recipient user tries to accept/reject the invitation from the kolab roundcube webmail *calendar* application he gets the Internal Server Error and the PHP Fatal Error and the stack trace I posted can be found from the logs.

Any tips how to best debug this issue?

Search for files with content "FLE Daylight Time" in /var/spool/imap/domain/ and provide a sample file.

Still can't find the way to reproduce the issue. Another source informed us that it had the same issue and there was CalDAV client involved. I reviewed the code and I don't see what actions could lead to such invalid timezone entries. Here's a patch that we could use, but I think the issue is in another place:

--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1974,6 +1974,8 @@ class calendar extends rcube_plugin
    */
   private function write_preprocess(&$event, $action)
   {
+    $event['start'] = preg_replace('/\s*\(.*\)/', '', $event['start']);
+    $event['end']   = preg_replace('/\s*\(.*\)/', '', $event['end']);
     // convert dates into DateTime objects in user's current timezone
     $event['start']  = new DateTime($event['start'], $this->timezone);
     $event['end']    = new DateTime($event['end'], $this->timezone);

Hmm, the user who has been reporting this issue uses some mobile email client in addition to the kolab roundcubemail, so it *might* be related to mobile client, but I'm not sure really..

Should I try using the patch you sent, or should we add more debug logging to catch/verify the bug, whenever we hit that again?

machniak claimed this task.

Patch applied in 239783c3dd576.