David King
2006-Nov-12 07:15 UTC
[Dovecot] assertion failed: (need_space == (uoff_t)-mails[idx].space)
I'm running Dovecot dovecot-1.0.r13 on FreeBSD (FreeBSD 6.1-RELEASE- p10). Mail is stored in mbox format (dovecot.conf after the msg). Procmail delivers mail to subfolders under ~/.mail, locking using dotfiles. One folder in particular for one user has an mbox file ~/.mail/Cron. Quite often, I'll see that procmail processes are stacking up because ~/.mail/Cron.lock exists, and they (rightly) refuse to deliver to a locked mailbox. It seems that dovecot is creating these lock files and then dying. The .lock file's contents refer to a PID that, by the time I see the lockfile, doesn't exist. It appears that dovecot is leaving behind the lock files, after exiting with a signal 6 (sometimes 11) and leaving behind messages in /var/log/maillog (and the end of this message). In dovecot.conf I have mail_drop_priv_before_exec = no, but I can't find the core file that I would expect it to dump, so I can't give you a backtrace. Hopefully the assertion in /var/log/maillog is enough. With ~/.mail/Cron perpetually locked, I'm not able to receive mail in this folder, and with any IMAP client that tries to access that folder having the IMAP server shut down, it keeps me from getting mail. Any ideas? # tail /var/log/maillog Nov 11 23:05:32 melchoir dovecot: imap-login: Login: user=<ketralnis>, method=PLAIN, rip=10.0.1.239, lip=10.0.0.1, TLS Nov 11 23:05:32 melchoir dovecot: IMAP(ketralnis): Disconnected: Logged out Nov 11 23:06:52 melchoir dovecot: IMAP(ketralnis): file mbox-sync- rewrite.c: line 405 (mbox_sync_read_and_move): assertion failed: (need_space == (uoff_t)-mails[idx].space) Nov 11 23:06:52 melchoir dovecot: child 16929 (imap) killed with signal 6 Here is dovecot.conf: # cat /usr/local/etc/dovecot.conf | sed -E 's/^(.*)#.*$/\1/' | grep - Ev '(^#|^[ ]*$' protocols = imap pop3 imaps pop3s ssl_cert_file = /etc/ssl/mail-cert.pem ssl_key_file = /etc/ssl/private/mail-key.pem disable_plaintext_auth = no login_user = dovecot verbose_proctitle = yes first_valid_gid = 0 mail_extra_groups = mail default_mail_env = mbox:%h/.mail:INBOX=/var/mail/%u mmap_disable = no lock_method = fcntl mbox_read_locks = dotlock mbox_write_locks = dotlock fcntl mail_drop_priv_before_exec = no protocol imap { login_greeting_capability = yes imap_client_workarounds = delay-newmail outlook-idle netscape-eoh tb-extra-mailbox-sep } protocol pop3 { pop3_uidl_format = %08Xu%08Xv pop3_client_workarounds = outlook-no-nuls oe-ns-eoh } auth default { mechanisms = plain login passdb pam { } userdb passwd { } userdb prefetch { } user = root }
Timo Sirainen
2006-Nov-12 11:19 UTC
[Dovecot] assertion failed: (need_space == (uoff_t)-mails[idx].space)
On Sat, 2006-11-11 at 23:15 -0800, David King wrote:> I'm running Dovecot dovecot-1.0.r13 on FreeBSD (FreeBSD 6.1-RELEASE- > p10). Mail is stored in mbox format (dovecot.conf after the msg).I fixed one reason for this in rc11, but I don't know why it would happen in rc13 anymore..> In dovecot.conf I have mail_drop_priv_before_exec = no, but I can't > find the core file that I would expect it to dump, so I can't give > you a backtrace. Hopefully the assertion in /var/log/maillog is enough.You need to have mail_drop_priv_before_exec=yes to get the core files, and ulimit -c set to be high enough before starting dovecot.> With ~/.mail/Cron perpetually locked, I'm not able to receive mail in > this folder, and with any IMAP client that tries to access that > folder having the IMAP server shut down, it keeps me from getting > mail. Any ideas?If it happens only for that one mailbox, can you easily reproduce the crash then? If so, could you put the mbox file through http://dovecot.org/tools/mbox-anonymize.pl and send it to me? There's something in the mbox that Dovecot doesn't seem to like.> passdb pam { > } > userdb passwd { > } > userdb prefetch { > }BTW. There's no use to have prefetch there, since passwd will always get used before that. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20061112/ccfa3846/attachment.bin>
David King
2006-Nov-13 05:24 UTC
[Dovecot] assertion failed: (need_space == (uoff_t)-mails[idx].space)
>> Ah, makes sense, I feel dumb now :) >> Here's a backtrace from imap.core, I can do more with the core if it >> helps >> #0 0x182bc437 in kill () from /lib/libc.so.6 >> #1 0x182bc3d6 in raise () from /lib/libc.so.6 >> #2 0x182baf02 in abort () from /lib/libc.so.6 > .. > Not having debugging information stripped would be helpful :)Well now I feel dumber :) FreeBSD uses the install-strip target in the Makefile to install the binaries, so even if I have -g in COPTS the binaries get stripped. I overwrote the binaries with those from src/ and reproduced the crash (which is as easy and opening the folder in an IMAP client), here's the new backtrace (gdb) bt #0 0x182bc437 in kill () from /lib/libc.so.6 #1 0x182bc3d6 in raise () from /lib/libc.so.6 #2 0x182baf02 in abort () from /lib/libc.so.6 #3 0x080b7355 in i_internal_panic_handler (fmt=0x0, args=0x0) at failures.c:382 #4 0x080b6dc9 in i_panic (format=0x0) at failures.c:180 #5 0x0807c19d in mbox_sync_read_and_move (sync_ctx=0xbfbfe8b0, mail_ctx=0xbfbfe580, mails=0x80fb000, seq=405589544, idx=0, padding=3217024224, move_diff=37, expunged_space=0, end_offset=3333, first_nonexpunged=true) at mbox-sync-rewrite.c:405 #6 0x0807c70e in mbox_sync_rewrite (sync_ctx=0xbfbfe8b0, mail_ctx=0x0, end_offset=3333, move_diff=37, extra_space=63, first_seq=1, last_seq=0) at mbox-sync-rewrite.c:507 #7 0x08076df9 in mbox_sync_handle_missing_space (mail_ctx=0xbfbfe7b0) at mbox-sync.c:854 #8 0x0807756b in mbox_sync_loop (sync_ctx=0xbfbfe8b0, mail_ctx=0xbfbfe7b0, partial=true) at mbox-sync.c:1158 #9 0x08078326 in mbox_sync_do (sync_ctx=0xbfbfe8b0, flags=MBOX_SYNC_REWRITE) at mbox-sync.c:1480 #10 0x08078bea in mbox_sync (mbox=0x80e5840, flags=MBOX_SYNC_REWRITE) at mbox-sync.c:1732 #11 0x08070456 in mbox_storage_close (box=0x80e5840) at mbox- storage.c:1063 #12 0x080a8607 in mailbox_close (_box=0x0) at mail-storage.c:371 #13 0x08058a4d in cmd_logout (cmd=0x80e8044) at cmd-logout.c:18 #14 0x0805b12c in client_handle_input (cmd=0x80e8044) at client.c:377 #15 0x0805b21d in _client_input (context=0x80e8000) at client.c:428 #16 0x080bd39c in io_loop_handler_run (ioloop=0x80e4000) at ioloop- poll.c:199 #17 0x080bccb8 in io_loop_run (ioloop=0x80e4000) at ioloop.c:281 #18 0x08064078 in main (argc=3, argv=0x0, envp=0x0) at main.c:280>> Sure, you can get it here: > You don't have X-IMAPbase or X-IMAP header in the first mail, so I > guess > you're also reading and modifying the mailbox outside Dovecot? That by > itself shouldn't break it as long as the locking is done correctly. > But > I guess your problem is somehow related to that. I couldn't anyway > cause > a crash using the file.Procmail writes to the folders, but it uses dotlocks, and I don't have logs of it crashing, whereas I do have logs of dovecot crashing :) I'm confused as to what the last sentence says, do you mean that you were able to reproduce the crash?