nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.63k stars 3.99k forks source link

[Bug]: Error while running background job (End of document reached prematurely) #43923

Closed Revertron closed 4 weeks ago

Revertron commented 6 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

Logging shows a lot of this errors.

"Error while running background job (class: OCA\\DAV\\BackgroundJob\\EventReminderJob, arguments: )"
"exception": {
        "Exception": "Sabre\\VObject\\EofException",
        "Message": "End of document reached prematurely",

Steps to reproduce

I don't know how to reproduce it. My installation worked for years without a problem, and starting from 28.0.2 it started to fill the log :(

Expected behavior

It should work without exceptions like this, I think.

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated from a MINOR version (ex. 22.1 to 22.2)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.zbin.eu"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.3.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "mysql.utf8mb4": true,
        "trashbin_retention_obligation": "auto",
        "versions_retention_obligation": "auto, 5",
        "installed": true,
        "loglevel": 2,
        "log_type": "file",
        "logdateformat": "F d, Y H:i:s",
        "log_rotate_size": 20971520,
        "theme": "",
        "default_phone_region": "SK",
        "remember_login_cookie_lifetime": 1296000,
        "session_lifetime": 259200,
        "session_keepalive": true,
        "maintenance": false,
        "logfile": "\/mnt\/hdd\/nextcloud\/nextcloud.log",
        "appstore.experimental.enabled": true,
        "debug": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "filesystem_check_changes": 1,
        "updater.release.channel": "stable",
        "dbport": "",
        "mail_smtpsecure": "ssl",
        "mail_smtpauthtype": "PLAIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.zbin.eu",
        "app_install_overwrite": [
            "tasks",
            "files_readmemd",
            "bruteforcesettings",
            "previewgenerator",
            "apporder",
            "bookmarks",
            "carnet",
            "ownnote",
            "news"
        ],
        "has_rebuilt_cache": true,
        "mail_sendmailmode": "smtp",
        "mail_smtpport": "465",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - apporder: 0.15.0
  - audioplayer: 3.4.1
  - bookmarks: 13.1.3
  - bruteforcesettings: 2.8.0
  - calendar: 4.6.5
  - carnet: 0.25.4
  - circles: 28.0.0-dev
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.2
  - contactsinteraction: 1.9.0
  - dav: 1.29.1
  - deck: 1.12.2
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_external: 1.20.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - nextcloud_announcements: 1.17.0
  - notes: 4.9.2
  - notifications: 2.16.0
  - oauth2: 1.16.3
  - password_policy: 1.18.0
  - photos: 2.4.0
  - previewgenerator: 5.4.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - support: 1.11.0
  - systemtags: 1.18.0
  - tasks: 0.15.0
  - text: 3.9.1
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - workflowengine: 2.10.0
Disabled:
  - activity: 2.20.0 (installed 2.5.2)
  - admin_audit: 1.18.0 (installed 1.2.0)
  - dashboard: 7.8.0 (installed 7.5.0)
  - encryption: 2.16.0
  - files_readmemd: 2.0.1 (installed 2.0.1)
  - files_retention: 1.17.0 (installed 1.17.0)
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - news: 24.0.0 (installed 24.0.0)
  - recommendations: 2.0.0 (installed 1.2.0)
  - sharerenamer: 3.2.0 (installed 3.2.0)
  - survey_client: 1.16.0 (installed 1.13.0)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2 (installed 1.4.1)
  - user_ldap: 1.19.0
  - weather_status: 1.8.0 (installed 1.3.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
    "reqId": "fzFEvfbsmzFl19vfi7Fi",
    "level": 3,
    "time": "March 01, 2024 00:36:03",
    "remoteAddr": "",
    "user": "--",
    "app": "core",
    "method": "",
    "url": "--",
    "message": "Error while running background job (class: OCA\\DAV\\BackgroundJob\\EventReminderJob, arguments: )",
    "userAgent": "--",
    "version": "28.0.3.2",
    "exception": {
        "Exception": "Sabre\\VObject\\EofException",
        "Message": "End of document reached prematurely",
        "Code": 0,
        "Trace": [
            {
                "file": "/var/www/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php",
                "line": 144,
                "function": "readLine",
                "class": "Sabre\\VObject\\Parser\\MimeDir",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php",
                "line": 90,
                "function": "parseDocument",
                "class": "Sabre\\VObject\\Parser\\MimeDir",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/3rdparty/sabre/vobject/lib/Reader.php",
                "line": 47,
                "function": "parse",
                "class": "Sabre\\VObject\\Parser\\MimeDir",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
                "line": 881,
                "function": "read",
                "class": "Sabre\\VObject\\Reader",
                "type": "::"
            },
            {
                "file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
                "line": 505,
                "function": "getCalendarTimeZone",
                "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php",
                "line": 206,
                "function": "deleteOrProcessNext",
                "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/apps/dav/lib/BackgroundJob/EventReminderJob.php",
                "line": 68,
                "function": "processReminders",
                "class": "OCA\\DAV\\CalDAV\\Reminder\\ReminderService",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
                "line": 81,
                "function": "run",
                "class": "OCA\\DAV\\BackgroundJob\\EventReminderJob",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->"
            },
            {
                "file": "/var/www/nextcloud/cron.php",
                "line": 152,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->"
            }
        ],
        "File": "/var/www/nextcloud/3rdparty/sabre/vobject/lib/Parser/MimeDir.php",
        "Line": 288,
        "message": "Error while running background job (class: OCA\\DAV\\BackgroundJob\\EventReminderJob, arguments: )",
        "exception": {},
        "CustomMessage": "Error while running background job (class: OCA\\DAV\\BackgroundJob\\EventReminderJob, arguments: )"
    }
}

Additional info

These log lines are all similar.

Revertron commented 6 months ago

Okay, I've got into my database, and found that some of calendars have an empty timezone column (not NULL). I've changed them to NULL, and there is no more such errors in the log, and I've got notification about some birthday! :)

image

But it would be better to add some check for this use case.

joshtrichards commented 2 months ago

Maybe change to empty() here:

https://github.com/nextcloud/server/blob/b3e4270135d5de64b2b4d43b3d08f00c91b7beab/apps/dav/lib/CalDAV/Reminder/ReminderService.php#L850-L852

SebastianKrupinski commented 1 month ago

@joshtrichards

That is a better solution.