owncloud / calendar

Calendar app for ownCloud
GNU Affero General Public License v3.0
121 stars 43 forks source link

Interal server error when downloading calendar #805

Open dbolton opened 7 years ago

dbolton commented 7 years ago

Steps to reproduce

  1. Go to the calendar app
  2. In the left pane, next to a specific calendar, choose "..." > "Download"

Expected behaviour

The calendar should download as an ics file.

Actual behaviour

Page loads with the following message:

ownCloud Internal Server Error

Technical details

Remote Address: 10.0.2.2
Request ID: OoGAiVubuc5HYXQ00gH0

ownCloud – web services under your control

Server configuration

Operating system: Ubuntu 16.04.3 LTS

Web server:

Database:

PHP version:

ownCloud version: 10.0.2 (stable)

Calendar version: 1.4.2

Updated from an older installed version or fresh install: Updated from older install

Signing status (ownCloud 9.0 and above): No errors have been found.

List of activated apps:

Enabled:

The content of config/config.php:

{ "system": { "instanceid": "ocn763i5uz2z", "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusteddomains": [ "192.168.1.88", ""REMOVED SENSITIVE VALUE" ], "datadirectory": "\/var\/www\/owncloud\/data", "overwrite.cli.url": "https:\/\/"REMOVED SENSITIVE VALUE\/", "dbtype": "mysql", "version": "10.0.2.1", "dbname": "oc", "dbhost": "localhost", "dbtableprefix": "oc", "dbuser": "REMOVED SENSITIVE VALUE", "dbpassword": "REMOVED SENSITIVE VALUE", "logtimezone": "UTC", "installed": true, "theme": "", "loglevel": 2, "maintenance": false, "updatechecker": false, "htaccess.RewriteBase": "\/" } }

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your instance's installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';

Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser: Firefox 54.0.1 (32-bit)

Operating system: Windows 10

CalDAV-clients:

Logs

Web server error log

Insert your webserver log here

Log file (data/owncloud.log)

Insert your ownCloud.log file here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...
DeepDiver1975 commented 7 years ago

@dbolton please have a look at the log file - you can search for the request id 'OoGAiVubuc5HYXQ00gH0' to find correlated messages - THX

dbolton commented 7 years ago

Here's the corresponding line from the log file:

{"reqId":"OoGAiVubuc5HYXQ00gH0","level":4,"time":"2017-08-07T02:03:08+00:00","remoteAddr":"10.0.2.2","user":"dbolton","app":"webdav","method":"GET","url":"\/remote.php\/dav\/calendars\/dbolton\/defaultcalendar?export","message":"Exception: {\"Message\":\"Unsupported VALUE parameter for DTEND property. You supplied \\"\\"\",\"Exception\":\"Sabre\\VObject\\InvalidDataException\",\"Code\":0,\"Trace\":\"#0 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Parser\\/MimeDir.php(453): Sabre\\VObject\\Document->createProperty('DTEND', NULL, Array)\n#1 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Parser\\/MimeDir.php(234): Sabre\\VObject\\Parser\\MimeDir->readProperty('DTEND;VALUE=;TZ...')\n#2 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Parser\\/MimeDir.php(217): Sabre\\VObject\\Parser\\MimeDir->parseLine('DTEND;VALUE=;TZ...')\n#3 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Parser\\/MimeDir.php(181): Sabre\\VObject\\Parser\\MimeDir->parseLine('DTEND;VALUE=;TZ...')\n#4 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Parser\\/MimeDir.php(89): Sabre\\VObject\\Parser\\MimeDir->parseDocument()\n#5 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Reader.php(46): Sabre\\VObject\\Parser\\MimeDir->parse('BEGIN:VCALENDAR...', 0)\n#6 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/CalDAV\\/ICSExportPlugin.php(307): Sabre\\VObject\\Reader::read('BEGIN:VCALENDAR...')\n#7 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/CalDAV\\/ICSExportPlugin.php(222): Sabre\\CalDAV\\ICSExportPlugin->mergeObjects(Array, Array)\n#8 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/CalDAV\\/ICSExportPlugin.php(151): Sabre\\CalDAV\\ICSExportPlugin->generateResponse('calendars\\/dbolt...', NULL, NULL, false, false, 'text\\/calendar', Array, Object(Sabre\\HTTP\\Response))\n#9 [internal function]: Sabre\\CalDAV\\ICSExportPlugin->httpGet(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#10 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/event\\/lib\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#11 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(479): Sabre\\Event\\EventEmitter->emit('method:GET', Array)\n#12 \\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/dav\\/lib\\/DAV\\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#13 \\/var\\/www\\/owncloud\\/apps\\/dav\\/lib\\/Server.php(229): Sabre\\DAV\\Server->exec()\n#14 \\/var\\/www\\/owncloud\\/apps\\/dav\\/appinfo\\/v2\\/remote.php(31): OCA\\DAV\\Server->exec()\n#15 \\/var\\/www\\/owncloud\\/remote.php(165): require_once('\\/var\\/www\\/ownclo...')\n#16 {main}\",\"File\":\"\\/var\\/www\\/owncloud\\/lib\\/composer\\/sabre\\/vobject\\/lib\\/Document.php\",\"Line\":220,\"User\":\"dbolton\"}"}

DeepDiver1975 commented 7 years ago

DTEND;VALUE=;TZ...

there is some invalid data in your database - please try to isolate this on event and we can try to fix it ....

dbolton commented 7 years ago

I opened the sql backup (mysqldump) in a text editor and found 64 matches to "DTEND;VALUE=;TZ".

If I'm understanding the ICAL format correctly it looks I might be able to simply remove any instances of VALUE=; (64 matches) or VALUE=: (161 matches)

Current example 1 DTEND;VALUE=;TZID=America/Chicago:20141122T160000 Probably the intended code: DTEND;TZID=America/Chicago:20141204T213000

Current example 2 DTEND;TZID=America/Chicago;VALUE=:20141204T213000 Probably the intended code: DTEND;TZID=America/Chicago:20141122T160000

Below is a sample that includes examples of VALUE=; and VALUE=: '1aea6d4b-6ce1-4030-b7f1-bcb2968bb553-caldavsyncadapter',0),(485,'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar 0.8.1\nBEGIN:VEVENT\r\nCREATED:20141121T154000Z\r\nLAST-MODIFIED:20141121T160845Z\r\nDTSTAMP:20141121T160845Z\r\nUID:93e26664-4e22-4d0d-acd4-650746c57d0c-caldavsyncadapter\r\nSUMMARY:Bring in messiah ticket\r\nSTATUS:CONFIRMED\r\nX-MOZ-LASTACK:20141121T160845Z\r\nDTSTART;TZID=America/Chicago:20141120T073000\r\nDTEND;VALUE=;TZID=America/Chicago:20141120T083000\r\nCLASS:PUBLIC\r\nX-MOZ-GENERATION:1\r\nBEGIN:VALARM\r\nACTION:DISPLAY\r\nTRIGGER;VALUE=DURATION:-PT10M\r\nDESCRIPTION:caldavsyncadapter standard description\r\nEND:VALARM\r\nEND:VEVENT\r\nEND:VCALENDAR','owncloud-257855f4c84934c495782c1a03cbd9dc.ics',2,1466445791,'35ce6989f8592a16d807b25de3cf3b45',581,'VEVENT',1416490200,1416493800,'93e26664-4e22-4d0d-acd4-650746c57d0c-caldavsyncadapter',0),(486,'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar 0.8.1\nBEGIN:VEVENT\r\nCREATED:20141125T170933Z\r\nLAST-MODIFIED:20141126T080613Z\r\nDTSTAMP:20141126T080613Z\r\nUID:8199e943-3c37-4f7a-87ae-21c74566b4ca-caldavsyncadapter\r\nSUMMARY:Pick up back stage tickets\r\nSTATUS:CONFIRMED\r\nX-MOZ-LASTACK:20141126T080613Z\r\nDTSTART;TZID=America/Chicago:20141125T184500\r\nDTEND;VALUE=;TZID=America/Chicago:20141125T194500\r\nCLASS:PUBLIC\r\nX-MOZ-GENERATION:1\r\nBEGIN:VALARM\r\nACTION:DISPLAY\r\nTRIGGER;VALUE=DURATION:-PT10M\r\nDESCRIPTION:caldavsyncadapter standard description\r\nEND:VALARM\r\nEND:VEVENT\r\nEND:VCALENDAR','owncloud-b083b455805034bf91bdcf31782a8e77.ics',2,1466445791,'3079260f2ce0ff8f29ede65f895b2537',584,'VEVENT',1416962700,1416966300,'8199e943-3c37-4f7a-87ae-21c74566b4ca-caldavsyncadapter',0),(487,'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar 0.8.1\nBEGIN:VEVENT\r\nLAST-MODIFIED:20141123T044900Z\r\nDTSTAMP:20141123T044900Z\r\nUID:9655fcd9-6eb5-4248-876f-bdfbd048ea03-caldavsyncadapter\r\nSUMMARY:Rehearse\r\nSTATUS:CONFIRMED\r\nX-MOZ-LASTACK:20141123T044900Z\r\nDTSTART;TZID=America/Chicago:20141122T150000\r\nDTEND;VALUE=;TZID=America/Chicago:20141122T160000\r\nCLASS:PUBLIC\r\nX-MOZ-GENERATION:2\r\nBEGIN:VALARM\r\nACTION:DISPLAY\r\nTRIGGER;VALUE=DURATION:-PT45M\r\nDESCRIPTION:caldavsyncadapter standard description\r\nEND:VALARM\r\nEND:VEVENT\r\nEND:VCALENDAR','owncloud-3e12f0df8c90f2eceb5aa3576d5d9b9d.ics',2,1466445791,'d6d5af7ef39257cd1477eaf893a12b88',540,'VEVENT',1416690000,1416693600,'9655fcd9-6eb5-4248-876f-bdfbd048ea03-caldavsyncadapter',0),(488,'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar 0.8.1\nBEGIN:VEVENT\r\nCREATED:20141202T073408Z\r\nLAST-MODIFIED:20141205T035746Z\r\nDTSTAMP:20141205T035746Z\r\nUID:a44785ec-dac9-4c8e-a967-86882573d3b6\r\nSUMMARY:Heritage Philharmonic rehearsal\r\nX-MOZ-LASTACK:20141205T035746Z\r\nDTSTART;TZID=America/Chicago:20141204T193000\r\nDTEND;TZID=America/Chicago;VALUE=:20141204T213000\r\nTRANSP:OPAQUE\r\nLOCATION:Blue River\r\nX-MOZ-GENERATION:2\r\nBEGIN:VALARM\r\nACTION:DISPLAY\r\nTRIGGER;VALUE=DURATION:-PT1H\r\nDESCRIPTION:Default Mozilla

PeterPablo commented 6 years ago

Did you continue your investigation and try to manually fixup your data?

dbolton commented 6 years ago

Sorry I didn't get back to this till today, but yes I was able to manually fix up the data. Below are steps I did to recover.

  1. I put ownCloud in maintenance mode
  2. I grabbed an sqldump
  3. I made a backup copy of the sqldump (so I could go back if my edits didn't work)
  4. I did two find and replaces. The first found 61 matches. The second found 161 matches Find: VALUE=; Replace: [blank]

    Find: ;VALUE=: Replace: :

  5. I uploaded the edited sqldump
  6. I turned maintenance mode off
  7. I logged in to ownCloud and downloaded the calendar. The calendar exported without issue.

I noticed others have had similar issues. For example: https://github.com/owncloud/core/issues/28114

dbolton commented 6 years ago

Here's another report of a blank "VALUE": https://github.com/owncloud/calendar/issues/799

dbolton commented 6 years ago

Here's a report where they went through the same fix as my second find and replace: https://github.com/owncloud/calendar/issues/466

kwoxer commented 6 years ago

It's nice to have a workaround somehow indeed. But I have currently 3 of 8 calenders. All are heavy used. And this would take me hours to proceed. As there are so many guys having that issue, why not patch this. And automatically do that cleaning of the sql? That should not be hard to manage.

fd0 commented 5 years ago

For the record, I also had this issue, this is how you do the replacing inline directly in the database:

update oc_calendar id, replace(calendardata, 'VALUE=;', '') from oc_calendarobjects where calendardata like '%;VALUE=:%';
update oc_calendar id, replace(calendardata, ';VALUE=:', ':') from oc_calendarobjects where calendardata like '%;VALUE=:%';

I had several hundred rows updated by the second statement. Hope this helps somebody :)

This was a user who only used "ical" on macOS and iOS.