Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UID validity is changed #374

Closed
link2xt opened this issue Jul 15, 2024 · 2 comments
Closed

UID validity is changed #374

link2xt opened this issue Jul 15, 2024 · 2 comments

Comments

@link2xt
Copy link
Contributor

link2xt commented Jul 15, 2024

On Jul 13 many user accounts got new INBOX UID validity resulting in lost messages due to deltachat/deltachat-core-rust#5774

We use maildir format.

User home contains files dovecot-uidlist and dovecot-uidvalidity.
dovecot-uidvalidity is created by mailbox_uidvalidity_write here:
https://github.com/dovecot/core/blob/52c9f93b1d9a343374f7b586a365d47dbed40bf4/src/lib-storage/mailbox-uidvalidity.c#L69
It contains UID validity as a hex value.
For example:

# cat dovecot-uidvalidity
6690a34c

0x6690a34c is 1720755020

The same UID validity is stored in dovecot-uidlist as the first entry:

# head -1 dovecot-uidlist
3 V1720755020 N1 G...

V corresponds to UID validity:
https://github.com/dovecot/core/blob/52c9f93b1d9a343374f7b586a365d47dbed40bf4/src/lib-storage/index/maildir/maildir-uidlist.h#L33

This is probably caused by cronjob removing files directly from the maildir and somehow causes Dovecot to recreate dovecot-uidlist. Affected users have dovecot-uidlist recreated with mtime and UID validity corresponding to Jul 13.

Some documentation of uidlist is at the beginning of maildir-sync:
https://github.com/dovecot/core/blob/52c9f93b1d9a343374f7b586a365d47dbed40bf4/src/lib-storage/index/maildir/maildir-sync.c#L93-L108

@link2xt
Copy link
Contributor Author

link2xt commented Jul 16, 2024

I have looked into UID validity values.

Here is an example core log:

2024-07-14T12:27:33.032Z	core/event            	INFO	""	1	"src/imap/select_folder.rs:227: uid/validity change folder INBOX: new 139/1720880574 previous 3333/1718053341."

So Delta Chat core thinks UID validity was updated from 2024-06-10 to 2024-07-13:

>>> datetime.datetime.fromtimestamp(1718053341, datetime.UTC)
datetime.datetime(2024, 6, 10, 21, 2, 21, tzinfo=datetime.timezone.utc)
>>> datetime.datetime.fromtimestamp(1720880574, datetime.UTC)
datetime.datetime(2024, 7, 13, 14, 22, 54, tzinfo=datetime.timezone.utc)

However on the server dovecot-uidlist has 1718053341 in the first line, dovecot-uidvalidity contains 666769dd and there is an empty file dovecot-uidvalidity.666769dd next to it. 0x666769dd is 1718053341, so it seems this is still an old timestamp.

So it looks like UID validity is not actually changed in the files after all. But running this on the server reports new UID validity 1720880574, which comes from I don't know where:

# doveadm mailbox status -u XXX uidvalidity INBOX
INBOX uidvalidity=1720880574

@link2xt
Copy link
Contributor Author

link2xt commented Jul 16, 2024

Ok, I figured out the problem, it was incorrectly configured mailboxes_dir that resulted in everyone getting a new homedir.

@link2xt link2xt closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant