Bug 744799

Summary: dovecot panic when accessing corrupt mail message on rebuilding index
Product: Red Hat Enterprise Linux 4 Reporter: Paul Bijnens <paul.bijnens>
Component: dovecotAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.9   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-26 12:31:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Paul Bijnens 2011-10-10 14:08:30 UTC
Description of problem:

Since the upgrade on aug 19, 2011 to dovecot-0.99.11-10.EL4, we get suddenly crashes when accessing certain folders.

The relevant entries in dovecot log:

  imap-login: Oct 09 11:31:31 Info: Login: paulb [::ffff:10.11.12.90]
  imap(paulb): Oct 09 11:37:05 Error: Corrupted index file /home/paulb/Maildir/.Arch-2007/.imap.index: Duplicated message 1318152995.P1683Q919M941772.xxx.yyy.com
  imap(paulb): Oct 09 11:40:19 Panic: file lib.c: line 37 (nearest_power): assertion failed: (num <= ((size_t)1 << (BITS_IN_SIZE_T-1)))

It seems to panic when rebuilding the index file.
From then on, access to that folder consistently crashes with the same panic line.

Some googling around brought up this:

  http://www.somerandomstuff.com/2011/09/30/dovecot-crash/

which seems to imply that the presence of a message with missing final boundary line seems to the cause. (missing a "--" at the end or even completely missing)

When searching my whole folder, there were indeed a few messages with a completely missing final boundary line.  Adding the mime boundary line manually fixed the problem.


Version-Release number of selected component (if applicable):

dovecot-0.99.11-10.EL4

How reproducible:


Steps to Reproduce:

1. Create a maildir folder on the server, populating it with a few messages, having at least a few one with attachments. (Easily done with an IMAP server, thunderbird and copying some existing messages.)

2. On the server, using a editor, remove the final mime boundary line on one of them (e.g. simulating the result of "no space left on device" when writing the message -- that is probably how it ended up there in 2007 in my folder). Try to find one, so that, when dovecot reads the messages, this one is not the last one in it's list.

3. Remove the .imap.index* files, so that Dovecot tries to rebuild them on access.

4.  Using thunderbird, subscribe to the folder, access it, and watch /var/log/dovecot.log

Comment 1 Michal Hlavinka 2011-10-26 12:31:29 UTC
I'm sorry for not addressing the issue in RHEL-4. RHEL-4.9 was last regular update release,  I'm closing this bugzilla WONTFIX. If you are still experiencing the issue with RHEL-5 or RHEL-6, feel free to reopen it against RHEL-5 or RHEL-6 respectively.