nextcloud / mail

đź’Ś Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
849 stars 262 forks source link

Cannot read/configure emails with PostgreSQL ( ERROR: invalid byte sequence for encoding "UTF8": 0xe9 ) #5215

Closed Pea13 closed 3 years ago

Pea13 commented 3 years ago

How to use GitHub

Steps to reproduce

  1. Install Nextcloud 20.0.4 (docker image)
  2. Configure your email account
  3. Validate

Expected behaviour

You should be able to read/view your emails

Actual behaviour

Interface hungs on "Loading messages"

Server configuration

Operating system: Linux Debian

Web server: Apache

Database: PostgreSQL 11.10

PHP version: 7.4.13

Nextcloud version: 20.0.4-apache (docker image)

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

Where did you install Nextcloud from: docker (with docker-compose)

Signing status:

Signing status ``` No errors have been found. ```

List of activated apps:

App list ``` Enabled: - accessibility: 1.6.0 - activity: 2.13.4 - bruteforcesettings: 2.0.1 - calendar: 2.1.3 - cloud_federation_api: 1.3.0 - comments: 1.10.0 - contacts: 3.4.3 - contactsinteraction: 1.1.0 - dashboard: 7.0.0 - dav: 1.16.2 - federatedfilesharing: 1.10.2 - federation: 1.10.1 - files: 1.15.0 - files_pdfviewer: 2.0.1 - files_rightclick: 0.17.0 - files_sharing: 1.12.1 - files_trashbin: 1.10.1 - files_versions: 1.13.0 - files_videoplayer: 1.9.0 - firstrunwizard: 2.9.0 - logreader: 2.5.0 - lookup_server_connector: 1.8.0 - mail: 1.7.2 - nextcloud_announcements: 1.9.0 - notifications: 2.8.0 - oauth2: 1.8.0 - password_policy: 1.10.1 - photos: 1.2.1 - privacy: 1.4.0 - provisioning_api: 1.10.0 - recommendations: 0.8.0 - richdocuments: 3.7.11 - richdocumentscode: 6.4.301 - serverinfo: 1.10.0 - settings: 1.2.0 - sharebymail: 1.10.0 - spreed: 10.0.5 - support: 1.3.0 - survey_client: 1.8.0 - systemtags: 1.10.0 - text: 3.1.0 - theming: 1.11.0 - twofactor_backupcodes: 1.9.0 - updatenotification: 1.10.0 - user_status: 1.0.1 - viewer: 1.4.0 - weather_status: 1.0.0 - workflowengine: 2.2.0 Disabled: - admin_audit - encryption - files_external - user_ldap ```

Nextcloud configuration:

Config report ``` { "system": { "htaccess.RewriteBase": "\/", "memcache.local": "\\OC\\Memcache\\APCu", "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "password": "***REMOVED SENSITIVE VALUE***", "port": 6379 }, "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "127.0.0.1:8181" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "pgsql", "version": "20.0.4.0", "overwrite.cli.url": "http:\/\/127.0.0.1:8181", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true } } ```

Are you using external storage, if yes which one: docker volumes (local)

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox 84.0.2

Operating system: Debian

Logs

Web server error log

Web server error log ``` nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:01 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 931 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:01 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:02 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:02 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:04 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:04 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 931 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:05 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:05 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:06 +0000] "GET /ocs/v2.php/apps/spreed/api/v2/room HTTP/1.1" 200 1585 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:07 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" nextcloud | 172.29.0.1 - - [14/Jan/2021:14:22:07 +0000] "POST /apps/mail/api/mailboxes/32/sync HTTP/1.1" 409 930 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0" ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` "class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","Line":235,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing 'INSERT INTO \"oc_mail_recipients\" (\"message_id\", \"type\", \"label\", \"email\") VALUES(?, ?, ?, ?)' with params [4058, 2, \"\\x50\\x69\\x65\\x72\\x72\\x65\\x2d\\x45\\x6d\\x6d\\x61\\x6e\\x75\\x65\\x6c\\x20\\x41\\x6e \\x64\\x72\\xe9\", \"pea@raveland.org\"]:\n\nSQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding \"UTF8\": 0xe9","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php"," line":169,"function":"convertException","class":"Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver","type":"->","args":["An exception occurred while executing 'INSERT INTO \"oc_mail_recipients\" (\"message_id\", \"type\", \"label\", \"email\") VALUES(?, ? , ?, ?)' with params [4058, 2, \"\\x50\\x69\\x65\\x72\\x72\\x65\\x2d\\x45\\x6d\\x6d\\x61\\x6e\\x75\\x65\\x6c\\x20\\x41\\x6e\\x64\\x72\\xe9\", \"pea@raveland.org\"]:\n\nSQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for enco ding \"UTF8\": 0xe9",{"errorInfo":["22021",7,"ERROR: invalid byte sequence for encoding \"UTF8\": 0xe9"],"__class__":"Doctrine\\DBAL\\Driver\\PDOException"}]},{"file":"/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php","line":149, "function":"wrapException","class":"Doctrine\\DBAL\\DBALException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver"},{"errorInfo":["22021",7,"ERROR: invalid byte sequence for encoding \"UTF8\": 0xe9"],"__class__":"Doctrine\\DB AL\\Driver\\PDOException"},"An exception occurred while executing 'INSERT INTO \"oc_mail_recipients\" (\"message_id\", \"type\", \"label\", \"email\") VALUES(?, ?, ?, ?)' with params [4058, 2, \"\\x50\\x69\\x65\\x72\\x72\\x65\\x2d\\x45\\x6d\\x6d\\x61\\x6 e\\x75\\x65\\x6c\\x20\\x41\\x6e\\x64\\x72\\xe9\", \"pea@raveland.org\"]:\n\nSQLSTATE[22021]: Character not in repertoire: 7 ERROR: invalid byte sequence for encoding \"UTF8\": 0xe9"]}, ```

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log mail: Sync failed because the mailbox is locked, retriggering ```

Database log

Database logs/config ``` postgresql | 2021-01-14 14:22:08.412 UTC [251] ERROR: invalid byte sequence for encoding "UTF8": 0xe9 postgresql | 2021-01-14 14:22:08.412 UTC [251] STATEMENT: INSERT INTO "oc_mail_recipients" ("message_id", "type", "label", "email") VALUES($1, $2, $3, $4) postgresql | 2021-01-14 14:22:08.416 UTC [251] ERROR: current transaction is aborted, commands ignored until end of transaction block postgresql | 2021-01-14 14:22:08.416 UTC [251] STATEMENT: UPDATE "oc_mail_mailboxes" SET "sync_new_lock" = $1, "sync_changed_lock" = $2, "sync_vanished_lock" = $3 WHERE "id" = $4 -- Configuration -- # psql -U postgres psql (11.10 (Debian 11.10-1.pgdg90+1)) Type "help" for help. postgres=# \l+ List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description -----------+-----------+----------+------------+------------+-------------------------+---------+------------+-------------------------------------------- nextcloud | nextcloud | UTF8 | en_US.utf8 | en_US.utf8 | nextcloud=CTc/nextcloud | 17 MB | pg_default | postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 | | 7693 kB | pg_default | default administrative connection database template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +| 7553 kB | pg_default | unmodifiable empty database | | | | | postgres=CTc/postgres | | | template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +| 7553 kB | pg_default | default template for new databases | | | | | postgres=CTc/postgres | | | ```
ChristophWurst commented 3 years ago

dup of https://github.com/nextcloud/mail/issues/4320