Hi, Sergey and all. I'm having problems with locking in imap4d. For example: User reads mail on phone with imap, leaving connection open. User then reads mail with movemail. User checks for mail in phone app. Imap gives panic message "mailbox corrupted, shrank in size".
Worse, there is a problem where mail files really do get corrupted. Some messages get some of the headers including X-UID copied into the start of the message, and the end of the message text is lost. I think this happens when there are two imap servers accessing the same mailbox. It seems that maybe imap tries to acquire the lock when it starts up, but then doesn't lock the file for later modifications. I say this because if I lock it manually with dotlock, then I can't read my mail with a new connection, but if my old connection is open, it will still read new messages. I discovered in the code a feature called mandatory-locking. I couldn't find any documentation for it. If I set this, then it seems that imap holds the lock for the entire time that it is connected. This presumably would fix my problems, but it causes problems of its own. In particular, sometimes I get orphan imap processes that are not really connected but are still there. If I set mandatory-locking, when this happens, the user won't be able to read their mail again until they remove the lock manually. What I would hope for is that imap would lock the file when it is modifying it, but not when it is idle. When it gets a new command, it would not assume that the file remained unmodified during a period of time that it was unlocked. Is this something I can configure or are these bugs that need to be fixed? Thanks. Ken