Repository navigation
Description
Expected behavior
Load Mails
Actual behavior
Stuck on Loading Messages
Mail app
Mail app version: 1.5.1 (see apps admin page, e.g. 0.5.3)
Mailserver or service: @Outlook.com (e.g. Outlook, Yahoo, Gmail, Exchange,...)
Server configuration
Operating system: Unraid 6.8.3, Docker 19.03.5 (e.g. Debian 8)
Web server: nginx (e.g. Apache, Nginx,...)
Database: PostgreSQL (e.g. MariaDB, SQLite or PostgreSQL)
PHP version: 7.3.23 (e.g. 7.0)
Nextcloud Version: 20.0.1 (see admin page, e.g. 13.0.2)
Client configuration
Browser: Chrome 86.0.4240.111 (e.g. Firefox 48)
Operating system: Windows 10 (e.g. Arch Linux)
After updating to 1.5.1, two servers (same machine, different docker) promted me to reenter mail account password. After that it stuck at "Loading Messages", They have pulled the Folder structure, if i click any folder, it displays how many mails are inside.
I tried the following:
Deleted the mail account
run occ mail:clean-up
disabled and removed app
reinstalled, added the account again
but i still get “Loading messages”.
Opened the database with pgAdmin
the account is added, but no new messages appear on the db.
Tried running occ mail:account:sync 10 -f (my current account id) and got:
[debug] account is up to date, skipping mailbox sync
In MailboxLockedException.php line 33:
331 is already being synced
After 3 hours i still get “331 is already being synced” so it doesn’t download anything…
Nextcloud log level to 0, doesn’t show anything for the mail app
On chromes network dev tab i see a tof on “sync” in the list and the preview is:
{status: “fail”,…}
data: {message: “401 is already being synced”, type: “OCA\Mail\Exception\MailboxLockedException”}
- message: "401 is already being synced"
- type: "OCA\Mail\Exception\MailboxLockedException"
status: “fail”
Looks like it affects other people too
https://help.nextcloud.com/t/mail-app-v1-5-1-stucks-on-loading-messages/96535/2
If you need any more info let me know
Activity
ChristophWurst commentedon Oct 30, 2020
as noted on the forums the locked mailbox is not an error
anyhting in your nextcloud.log that indicates an error?
maurerle commentedon Oct 30, 2020
I get the same stuck loading messages behavior.
Error log shows:
and
stavros-k commentedon Oct 31, 2020
After doing more cleaning,
Deleting all oc_mail* columns
and deleting all rows specific to mail app from oc_migrations
deleting /data/appdata*/mail and /config/www/nextcloud/apps/mail
Also manualy patched this nextcloud/server#23606 to cleanup the error log.
Reinstalled the mail app and i got the same errors as above.
On database i can see the account created but 0 messages downloaded
EDIT* the Error connecting to mail server might not be related (probably server problem?) After 2 Error connecting to mail server i got the same errors again (iconv and ServiceException))
stavros-k commentedon Nov 1, 2020
After looking around found that probably php iconv has an issue on alpine images. Applied this fix
docker-library/php#240 (comment) (changed php version to 7.3.23), and it started downloading messages. But after i had warning when trying to open specific folders, and an error coming up without touching the mail app.
The folders and mails are opening, even those that give warnings.
Error Module 'iconv' already loaded at Unknown#0
Waring KItinerary binary adapter is not available, can't extract information
The error seems right, since i have installed another iconv version/package. But i dont know what to look next.
I Don't know if this help pin point my problem, i'd call myself a newbie on linux and php. But i figured i should post my findings.
ChristophWurst commentedon Nov 3, 2020
Yeah it looks like an issue with the
iconvconversion indeed. On the other handiconvcan legitimately returnfalseif the conversion fails. @rullzer a case we didn't consider in your PR ;)ChristophWurst commentedon Nov 3, 2020
@stavros-k is that the original email that cause this? Because then I'm quite confused and it might indeed be the alpine issue you posted.
maurerle commentedon Nov 3, 2020
@ChristophWurst I had "activation@embarcadero.com" in the error message (yes people are still using delphi).
Also running on 20-fpm-alpine. No issues with 19-fpm-alpine.
Can I savely try the docker:20-fpm without alpine?
ChristophWurst commentedon Nov 3, 2020
I'm not familiar with the docker setups, so I can't give any recommendations on that, sorry.
maurerle commentedon Nov 3, 2020
I just tried and the standard user seems to be different between 20-fpm-alpine and 20-fpm.
I added
user: "82:33"to the nextcloud docker-container in the compose file.
Also had to add the userid to the cron execution.
But now it is working and fetching mail.
ChristophWurst commentedon Nov 3, 2020
Cool. I'm concluding the iconv is the only issue of this specific problem, but this is out of scope for us and needs to be fixed externally.
ChristophWurst commentedon Nov 5, 2020
🤡 https://stackoverflow.com/a/63747282/2239067
stavros-k commentedon Nov 5, 2020
I fixed it with the following script. There might be easier way out there. But this script i found somewhere (i dont really remember sorry) fixed it.
johanneshorak commentedon Nov 18, 2020
I had the same issue and I was able to trace it back to encoding problems as well, however, mainly in nextcloud and the database it uses. For me , changing the format from utf8 to utf8mb4 solved it. I noticed that running
php -f occ mail:account:sync 1always failed at some messages (assume accountid is 1):Sync failed for 1:INBOX: An exception occurred while executing 'INSERT INTO oc_mail_messages (uid, message_id, mailbox_id, subject, sent_at, flag_answered, flag_deleted, flag_draft, flag_flagged, flag_seen, flag_forwarded, flag_junk, flag_notjunk,flag_important) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [27566, "<redacted by me>", 110, "\u00fc \u00fc \ud83d\udc9a", 1600446988, false, false, false, false, true, false, false, false, false]: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x92\x9A' for column 'subject' at row 1(I removed the unimportant parts of the subject).
So I googled a bit and found how you can enable mysql4 byte support in nextcloud.
For my
postgresqlmysql database it boiled down to steps 4,5 and 6 in the mysql subsection:Change your databases character set and collation:
ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;Set the mysql.utf8mb4 config to true in your config.php:
$ sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"Convert all existing tables to the new collation by running the repair step:
$ sudo -u www-data php occ maintenance:repairAfter that, the messages started showing up.
ChristophWurst commentedon Nov 18, 2020
Good finding @johanneshorak. MySQL 4Byte support is indeed required. Yet it's a different problem than the iconv one. But thanks for the info.
Postgres? Are you sure?
johanneshorak commentedon Nov 18, 2020
@ChristophWurst Thank you!
About postgres: My mistake, it's a mysql database of course. I'll correct it in the post above to avoid further confusion.
stavros-k commentedon Nov 18, 2020
Im using postgre, so i dont think this is the problem! It's how the iconv in the alpine image i'm using is compiled.
It's already discussed on LSIO github and i think they have addressed a fix or sometihng.
ChristophWurst commentedon Nov 18, 2020
Indeed. But this is nothing we can fix inside our app.
stavros-k commentedon Nov 18, 2020
Yes, i know, for now i'm applying the "patch" mentioned above, until LSIO updates the container
canatella commentedon Jan 18, 2021
Hello, I'm running nextcloud in an Alpine Linux LXC container and I'm hit by this issue too. Looking at the Alpine bug, it seems to be linked to the fact that Alpine use musl and busybox which have their own implementation of iconv. The posix manpage for
iconv_opendoesn't mention the//IGNOREextension provided in the gnu libc iconv, so it seems this is not really a bug in Alpine neither.Assuming the most common case is the email address being valid utf-8, you could first do a conversion to
UTF-8and check the return value to see if it is indeed valid utf-8. If it returns false you could then fallback on usingUTF-8//IGNOREto try to fix things up, but I wonder why you would accept any input in that case. It means the address is somehow borked so it is going to be wrong anyway.ChristophWurst commentedon Jan 18, 2021
That's basically why that statement is there. How can we check the return value to see if it is indeed valid utf-8?
canatella commentedon Jan 18, 2021
From my understanding and looking at
man 3 iconvand the musl code: https://git.musl-libc.org/cgit/musl/tree/src/locale/iconv.c#n257, is that if you run withUTF-8it will fail when stumbling upon an invalid input byte sequence:From
man 3 iconv_open, if you pass//IGNORE:So using
UTF-8would make it fail on invalid utf-8, usingUTF-8//IGNOREwould make ignore and drop the invalid utf-8 bytes.canatella commentedon Jan 18, 2021
That said, I'm looking at the current code and it seems that the error is handled now:
mail/lib/Address.php
Line 81 in 51504e3
//IGNOREserves no purpose here if what's wanted is just to ensure that the address is valid utf-8. The//IGNOREwould make it ignore those case...EDIT: And the current code will still fail on Alpine, so it I think the
//IGNOREshould really be removed here.