Page 1 of 1

Scheduled task pop3 polling issue after NG doMailboxMove

Posted: Wed Oct 13, 2021 10:51 am
by gabrieles
Hi,
we found a strange behaviour after moving from one mailstore to another accounts that have "External Account" set up.
Basically the polling task continues to run on original mailstore, ignoring the fact that the mailbox is no more there.
In the particular case of POP3, with remote deletion enabled, this could result in a message loss.

All mailstores are 8.8.15_P25, NG modules are 6.0.26.1625817564-1.u16

Steps to reproduce the issue:
- Have two mailstores
- Create an account on mailstore1
- Set up for that account an External Account datasource, polling via POP3 some other account (not production account, you could lose messages)
- Move that account on mailstore2 with zxsuite hsm doMailboxMove
- Monitor the mailbox.log on mailstore1, grepping ScheduledTask

You will see message polled and "adding message" being made on mailstore1, not 2.
The account is now on mailstore2 and has no sign of these messages that exist only on /opt/zimbra/store/... and on mysql of mailstore1

Re: Scheduled task pop3 polling issue after NG doMailboxMove

Posted: Wed Oct 13, 2021 11:11 am
by gabrieles
Actually we recovered some lost emails reconstructing the blobfile position via mailbox.log data and added them with zmmailbox addMessage.
If your logs are too old and have been rotated, the recover is almost impossible. The blobfile are somewhere in the /opt/zimbra/store but you can't know exactly where.

Example: an account mickey@mydomain.com on zimbra that polls in pop3 an external account donald@gmail.com

You need:
- the original recipient (donald@gmail.com)
- the day of the mail loss (for the rotated log)

Workaround:

- Search in the mailbox.log or in the rotated gz any occurrence of scheduled tasks with adding message
zcat /usr/local/src/mailbox.log.2021-10-04.gz | egrep 'ScheduledTask.*Adding Message' | egrep 'ds=donald@gmail.com'

- You will find variou lines like these:
2021-10-04 12:22:03,066 INFO [ScheduledTask-74] [name=mickey@mydomain.com;mid=168;ds=donald@gmail.com;] mailop - Adding Message: id=1288, Message-ID=<31548799-77D4-F8FD-D9FF-C786647EF5CCjava@mydomain.ciao>, parentId=-1, folderId=2, folderName=Inbox acct=96654f31-ee71-4340-8764-ec557ef9800f.

- Important info are:
2021-10-04 12:22:03 - polling time: it's not delivery time. first two are in fact identical
name=mickey@mydomain.com - local account on ZIMBRA
ds=donald@gmail.com - the datasource that in that case corresponds to the REMOTE account
id=1288 - mysql id of the message
mid=168 - mysql id of mickey@mydomain.com

- With these info search the correct store path:
find /opt/zimbra/store/0/168/msg/ -type f |grep 1288-
/opt/zimbra/store/0/168/msg/0/1288-14063.msg

- Inject that blobfile with zmmailbox addMessage
zmmailbox -z -m mickey@mydomain.com am /inbox /opt/zimbra/store/0/168/msg/0/1288-14063.msg