Dovecot Panic: file mail-transaction-log.c
I got a call last week from a client that was having some issues with retrieving email from a Dovecot IMAP server. The client was connecting over TLS and was using an Apple mail client. Upon checking the mailserver log, I was greeted with a flood of rather vicious looking errors. I’m not gonna post the entire backtrace since its rather long, but you’ll get the idea.
Panic: file mail-transaction-log.c: line 271 (mail_transaction_log_rotate): assertion failed: (file->locked) Error: Raw backtrace: /usr/lib/dovecot/libdovecot.so.0 [0x27c5bf] -> /usr/lib/dovecot/libdovecot.so.0 [0x27c63d] -> /usr/lib/dovecot/libdovecot.so.0 [0x27bf6b] -> /usr/lib/dovecot/libdovecot-storage.so.0(mail_transaction_log_rotate+0x181)... Fatal: master: service(imap): ***** 3813 killed with signal 6 (core dumps disabled)
Obviously you would never want to see words like “Panic” and “Fatal” in your logs, but in this case it was nothing too serious. After confirming that there was no actual damage to the client’s mailbox, I shifted focus to Dovecot’s index files. By accessing the clients account through a telnet connection and opening the different folders, I immediatly got disconnected while accessing the INBOX folder.
telnet mail.tld 143 a login user password b select foldername c logout
When the bad apple (pun intended) had been identified, I deleted the corrupt dovecot.index* files from the folder in question.
mail/.imap/INBOX/ total 528 site93 4096 Oct 12 05:40 . site93 4096 Feb 12 2016 .. site93 22288 Oct 12 05:40 dovecot.index site93 460492 Oct 12 13:19 dovecot.index.cache site93 4044 Oct 12 13:23 dovecot.index.log site93 32852 Oct 12 05:40 dovecot.index.log.2
Dovecot creates these files automatically when the mailbox is opened so deleting them wont cause any issues.
After this fix, the client had no further issues.