Old messages get vanished when new messages arrives
Expected behavior
Tell us what should happen
I would like to see all INBOX messages after a new message arrives.
Actual behavior
Tell us what happens instead
When a new message arrives, all other messages are vanished. After clearing the cache everything is back. Please see the screencast video. I have tracked it down to the ImapToDbSychronizer.runPartialSync method line 405-410
$this->dbMapper->deleteByUid($mailbox, ...$chunk);
@ChristophWurst: I can provide the credentials for the test account. I'm a bit stuck on how to proceed. Any help is appreciated.
https://user-images.githubusercontent.com/74589100/111156683-50ac7480-8596-11eb-88c2-fbd6a3bb9ecc.mp4
Mail app
Mail app version: (see apps admin page, e.g. 0.5.3) 1.10.0-alpha.1 -> current git sources
Mailserver or service: (e.g. Outlook, Yahoo, Gmail, Exchange,...) output from imapsync
Host2: found ID capability. Sending/receiving ID, presented in raw IMAP for now. In order to avoid sending/receiving ID, use option --noid Sending: 4 ID ("name" "imapsync" "version" "1.977" "os" "linux" "vendor" "Gilles LAMIRAL" "support-url" "https://imapsync.lamiral.info/" "date" "23-Dec-2019 20:18:02 +0000" "side" "host2") Sent 181 bytes Read: * ID ("name" "RZimapd" "version" "4.41.2" "vendor" "Strato AG" "support-url" "mailto:[email protected]") 4 OK ID command completed
Host2 capability once authenticated: IMAP4 IMAP4rev1 APPENDLIMIT=104857600 AUTH=PLAIN AUTH=LOGIN AUTH=CRAM-MD5 AUTH=DIGEST-MD5 METADATA LIST-EXTENDED SNIPPET=FUZZY PREVIEW=FUZZY SPECIAL-USE CREATE-SPECIAL-USE ESORT ESEARCH SEARCH=FUZZY CONDSTORE URLAUTH CHILDREN ENABLE I18NLEVEL=2 ID IDLE MOVE MULTIAPPEND NAMESPACE QUOTA SORT STATUS=SIZE UIDPLUS UNSELECT WITHIN XLIST APPENDLIMIT AUTH SNIPPET PREVIEW SEARCH I18NLEVEL STATUS
Server configuration
Operating system: (e.g. Debian 8) Ubuntu 20.04.2 LTS 5.4.72-microsoft-standard-WSL2
Web server: (e.g. Apache, Nginx,...) Apache 2.4.41
Database: (e.g. MariaDB, SQLite or PostgreSQL) MariaDB 10.3.25
PHP version: (e.g. 7.0) PHP 7.4.3
Nextcloud Version: (see admin page, e.g. 13.0.2) 22.0.0.2 -> current git sources
Client configuration
Browser: (e.g. Firefox 48) Firefox 86
Operating system: (e.g. Arch Linux) Windows 10
I have tracked it down to the ImapToDbSychronizer.runPartialSync method line 405-410
:eyes:
What mail server is that? I've seen gmail occasionally clearing the inbox
sorry, seems that I was not clear enough.
The messages are still in the INBOX. I can see them with other clients. But they are deleted from the nextcloud mail database table oc_mail_messages and therefore they are not visible in Mail. After clearing the cache in Nextcloud Mail everything is back.
The server reports itself as RZimapd 4.41.2 from Strato AG. Strato is a rather big provider for hosting and server here in germany. I have rented a vServer from Strato for my families nextcloud. But I use their servers for mailing.
no, sorry, I got what you tried to say. I didn't mean that the inbox on Gmail was cleared but the cache representation of it was cleared, just like you described.
ok, I am some steps further now....
in https://github.com/horde/Imap_Client/blob/e5302ee8b238f03564d0ea4177625214f79a3ebe/lib/Horde/Imap/Client/Base.php#L3993
we have the following code: /* Search for deleted messages, and remove from cache. */ $vanished = $this->vanished($this->_selected, $modseq, array( 'ids' => $uids_ob )); $disappear = array_diff($uids_ob->ids, $vanished->ids); if (!empty($disappear)) { $this->_deleteMsgs($this->_selected, $this->getIdsOb($disappear)); }
the array_diff here is redunant, because this is already done in the vanished function, so that it returns already only vanished IDs! see here: https://github.com/horde/Imap_Client/blob/e5302ee8b238f03564d0ea4177625214f79a3ebe/lib/Horde/Imap/Client/Base.php#L2829
So, how can we proceed as this seems to be an issue in horde not in mail. I m not sure if it is still maintained here on github.
What a finding! Kudos!
So, how can we proceed as this seems to be an issue in horde not in mail. I m not sure if it is still maintained here on github.
It's not very active, but they typically merge and release fixes after a few days/weeks when we submit them upstream.
Just to understand the problem better: what needs to be changed in horde to solve this problem?
I have just removed the $disappear array, so now it looks like:
/* Search for deleted messages, and remove from cache. */
$vanished = $this->vanished($this->_selected, $modseq, array(
'ids' => $uids_ob
));
if (!empty($vanished->ids)) {
$this->_deleteMsgs($this->_selected, $this->getIdsOb($vanished->ids));
}
Can/Will you submit this fix upstream?
sorry, here is the code location: /var/www/apps/mail/vendor/pear-pear.horde.org/Horde_Imap_Client/Horde/Imap/Client/Base.php Horde_Imap_Client_Base->_condstoreSync() line: 3992 - 3999
I have created a pull request for horde imap client see here Hope it gets merged soon
https://github.com/nextcloud/mail/issues/4973#issuecomment-831252030 we have more people who confirm that your patch works :)
great, but my PR at horde is still pending 😢
Yeah, I know. I'll send a friendly push.
Thanks! 👍
This didn't seem to make a difference to me - I changed the code and removed and re-added the account. Anything else I should try?
What happened after you readded the account? Messages vanished again?
Yeah behaves the same. If I jump between mailbox folders (like go to sent and back to inbox repeatedly) it goes further and further back in time as the most recent emails.
wow, strange....but I guess this is something else. maybe it is a good idea to open a new issue for it. What is your email provider/server?
In my case mails gets vanisched in Nexcloud Mail while resyncing the INBOX because of some changes on server side... e.g. new mail arrives
🎉 the horde bugfix was merged into master https://github.com/horde/Imap_Client/pull/11#issuecomment-841843473
:rocket: awesome! Now we have to be patient another time with the release of this patch :)
rocket awesome! Now we have to be patient another time with the release of this patch :)
Here it is: https://github.com/nextcloud/mail/pull/5048