nextcloud / server

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

[Bug]: DriverException during BackgroundJob #47275

Open AndyFx12 opened 3 weeks ago

AndyFx12 commented 3 weeks ago

⚠️ This issue respects the following points: ⚠️

Bug description

On every backgroundjob I see an error at protocol: DriverException An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR: column "cr.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT "cr".*, "co"."calendardata", "c"."displayname", "c"."... ^ Error while running background job OCA\DAV\BackgroundJob\EventReminderJob (id: 9156, arguments: null)

Steps to reproduce

  1. Use NC30 RC1
  2. Let CRON start backgroundjobs
  3. Look at your logfile.

Expected behavior

No error should be visible.

Installation method

None

Nextcloud Server version

30rc1

Operating system

Ubuntu 22.04

PHP engine version

8.2

Web server

Apache

Database engine version

PostgreSQL

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

{
    "system": {
        "debug": false,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "simpleSignUpLink.shown": false,
        "trusted_domains": [
            "cloud.s-t-franz.de",
            "localhost",
            "192.168.1.3",
            "nextcloud"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/192.168.1.3\/nextcloud",
        "overwritehost": "cloud.s-t-franz.de",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "30.0.0.8",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "session_relaxed_expiry": false,
        "mail_smtpmode": "smtp",
        "log_rotate_size": "10485760",
        "maintenance_window_start": "1",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0.5,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "htaccess.RewriteBase": "\/",
        "loglevel": "2",
        "log_type": "file",
        "logfile": "\/mnt\/ncdata\/nextcloud.log",
        "logtimezone": "Europe\/Berlin",
        "default_phone_region": "DE",
        "maintenance": false,
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpstreamoptions": {
            "ssl": {
                "allow_self_signed": true,
                "verify_peer": false,
                "verify_peer_name": false
            }
        },
        "theme": "",
        "updater.release.channel": "beta",
        "app_install_overwrite": [
            "calendar",
            "bruteforcesettings",
            "admin_notifications",
            "onlyoffice",
            "files_trackdownloads",
            "checksum",
            "music",
            "twofactor_totp",
            "twofactor_email",
            "impersonate",
            "previewgenerator"
        ],
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [],
        "has_rebuilt_cache": true,
        "mail_sendmailmode": "smtp"
    }
}

List of activated Apps

Enabled:
  - activity: 3.0.0
  - admin_audit: 1.20.0
  - admin_notifications: 1.0.2
  - bruteforcesettings: 3.0.0
  - checksum: 1.2.4
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contactsinteraction: 1.11.0
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - firstrunwizard: 3.0.0
  - impersonate: 1.17.0
  - integration_openai: 3.0.1
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - nextcloud_announcements: 2.0.0
  - notifications: 3.0.0
  - oauth2: 1.18.0
  - password_policy: 2.0.0
  - photos: 3.0.2
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - support: 2.0.0
  - survey_client: 2.0.0
  - systemtags: 1.20.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - twofactor_email: 2.7.4
  - twofactor_totp: 12.0.0-dev
  - updatenotification: 1.20.0
  - user_ldap: 1.21.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - workflowengine: 2.12.0
Disabled:
  - circles: 30.0.0-dev (installed 28.0.0-dev)
  - dashboard: 7.10.0 (installed 7.1.0)
  - encryption: 2.18.0
  - files_external: 1.22.0
  - suspicious_login: 8.0.0
  - text: 4.1.0 (installed 3.9.1)
  - twofactor_nextcloud_notification: 4.0.0
  - weather_status: 1.10.0 (installed 1.0.0)
  - webhook_listeners: 1.1.0-dev

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"6jbk5hTxCTGD3EtOmsWM","level":3,"time":"2024-08-16T12:15:08+02:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 9156, arguments: null)","userAgent":"--","version":"30.0.0.8","exception":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^","Code":7,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1943,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\PostgreSQL\\ExceptionConverter","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1885,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1106,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":312,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":48,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":271,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":248,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/Backend.php","line":53,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php","line":104,"function":"getRemindersToProcess","class":"OCA\\DAV\\CalDAV\\Reminder\\Backend","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/BackgroundJob/EventReminderJob.php","line":50,"function":"processReminders","class":"OCA\\DAV\\CalDAV\\Reminder\\ReminderService","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\DAV\\BackgroundJob\\EventReminderJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":83,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":73,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":162,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/PostgreSQL/ExceptionConverter.php","Line":87,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^","Code":7,"Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":132,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1099,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":312,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":48,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":271,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":248,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/Backend.php","line":53,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php","line":104,"function":"getRemindersToProcess","class":"OCA\\DAV\\CalDAV\\Reminder\\Backend","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/BackgroundJob/EventReminderJob.php","line":50,"function":"processReminders","class":"OCA\\DAV\\CalDAV\\Reminder\\ReminderService","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\DAV\\BackgroundJob\\EventReminderJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":83,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":73,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":162,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":28,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[42803]: Grouping error: 7 ERROR:  column \"cr.id\" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: SELECT \"cr\".*, \"co\".\"calendardata\", \"c\".\"displayname\", \"c\".\"...\n               ^","Code":"42803","Trace":[{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":130,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1099,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/Connection.php","line":312,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/ConnectionAdapter.php","line":48,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":271,"function":"executeQuery","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":248,"function":"executeQuery","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/Backend.php","line":53,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/CalDAV/Reminder/ReminderService.php","line":104,"function":"getRemindersToProcess","class":"OCA\\DAV\\CalDAV\\Reminder\\Backend","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/BackgroundJob/EventReminderJob.php","line":50,"function":"processReminders","class":"OCA\\DAV\\CalDAV\\Reminder\\ReminderService","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\DAV\\BackgroundJob\\EventReminderJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":83,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":73,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":162,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":130}},"message":"Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 9156, arguments: null)","exception":{},"CustomMessage":"Error while running background job OCA\\DAV\\BackgroundJob\\EventReminderJob (id: 9156, arguments: null)"}}

Additional info

No response

kesselb commented 3 weeks ago

cc @ChristophWurst @miaulalala @SebastianKrupinski

miaulalala commented 3 weeks ago

Hello full GROUP MY, my old f(r)iend. Not MYSQL; the same principle applies.

ChristophWurst commented 3 weeks ago

Yep: https://github.com/nextcloud/server/pull/41740#pullrequestreview-1750403628

ChristophWurst commented 3 weeks ago

@hamza221 this should be easy to reproduce if you use mysql/mariadb and (temporarily) enable strict mode. Every SELECTed column has to be in the GROUP BY as well. Expand cr.* to the individual columns in SELECT and GROUP BY.