Cached message size smaller than expected

David Saez eslist at ols.es
Wed Jan 7 19:03:11 UTC 2015


Hi

Since i upgraded to Dovecot 2.2.15 i start experiencing
"Cached message size smaller than expected" errors that
render a whole imap folder unusable as dovecot panics.

I used Timo Sirainen maildir-size-fix.pl v1.1 script to try
to fix the sizes but it does not seem to work

trying to access the maildir produces this log in dovecot:

Jan 07 19:34:13 imap(forumed at forumed.biz): Error: 
read(zlib(/var/spool/exim/mail/forumed.biz/forumed/.Sent/cur/1386527120.M104960P2012.mail,S=7725131:2,S)) 
failed: Cached message size smaller than expected (7725131 < 7729083, 
box=Sent, UID=2734)
Jan 07 19:34:13 imap(forumed at forumed.biz): Error: Maildir filename has 
wrong S value, renamed the file from 
/var/spool/exim/mail/forumed.biz/forumed/.Sent/cur/1386527120.M104960P2012.mail,S=7725131:2,S 
to 
/var/spool/exim/mail/forumed.biz/forumed/.Sent/cur/1386527120.M104960P2012.mail,S=7729084:2,S
Jan 07 19:34:13 imap(forumed at forumed.biz): Error: Corrupted index cache 
file /var/spool/exim/mail/forumed.biz/forumed/.Sent/dovecot.index.cache: 
Broken physical size for mail UID 2734
Jan 07 19:34:13 imap(forumed at forumed.biz): Panic: file istream.c: line 
167 (i_stream_read): assertion failed: (old_size <= _stream->pos - 
_stream->skip)
Jan 07 19:34:13 imap(forumed at forumed.biz): Error: Raw backtrace: 
/usr/local/lib/dovecot/libdovecot.so.0(+0x75e1a) [0x7feb14469e1a] -> 
/usr/local/lib/dovecot/libdovecot.so.0(+0x75e96) [0x7feb14469e96] -> 
/usr/local/lib/dovecot/libdovecot.so.0(i_error+0) [0x7feb1441b2bf] -> 
/usr/local/lib/dovecot/libdovecot.so.0(i_stream_read+0x214) 
[0x7feb144731f4] -> 
/usr/local/lib/dovecot/libdovecot.so.0(i_stream_read_data+0x52) 
[0x7feb144733b2] -> 
/usr/local/lib/dovecot/libdovecot.so.0(message_get_body_size+0xa9) 
[0x7feb1445da89] -> 
/usr/local/lib/dovecot/libdovecot-storage.so.0(index_mail_init_stream+0x16f) 
[0x7feb1473795f] -> 
/usr/local/lib/dovecot/libdovecot-storage.so.0(+0x2dacc) 
[0x7feb14701acc] -> 
/usr/local/lib/dovecot/libdovecot-storage.so.0(mail_get_stream+0x4d) 
[0x7feb1470f3ed] -> 
/usr/local/lib/dovecot/libdovecot-storage.so.0(+0x2e3e8) 
[0x7feb147023e8] -> 
/usr/local/lib/dovecot/libdovecot-storage.so.0(mail_get_virtual_size+0x2b) 
[0x7feb1470f07b] -> dovecot/imap() [0x41b2f5] -> dovecot/imap() 
[0x419d6c] -> dovecot/imap(imap_fetch_more+0x31) [0x419fa1] -> 
dovecot/imap() [0x40ebb0] -> dovecot/imap(command_exec+0x3d) [0x4183ad] 
-> dovecot/imap() [0x416a7e] -> dovecot/imap(client_output+0x10b) 
[0x417adb] -> /usr/local/lib/dovecot/libdovecot.so.0(+0x931d9) 
[0x7feb144871d9] -> 
/usr/local/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x5b) 
[0x7feb1447b0db] -> 
/usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0xaf) [0x7feb1447c27f] 
-> /usr/local/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x9) 
[0x7feb1447b169] -> 
/usr/local/lib/dovecot/libdovecot.so.0(io_loop_run+0x38) 
[0x7feb1447b1f8] -> 
/usr/local/lib/dovecot/libdovecot.so.0(master_service_run+0x13) 
[0x7feb14420193] -> dovecot/imap(main+0x2b0) [0x4210d0] -> 
/lib/libc.so.6(__libc_start_main+0xfd) [0x7feb140b1c4d] -> 
dovecot/imap() [0x40bea9]
Jan 07 19:34:13 imap(forumed at forumed.biz): Fatal: master: service(imap): 
child 9337 killed with signal 6 (core not dumped)


1386527120.M104960P2012.mail,S=7725131:2,S is actually a gzip
compressed mail, it's compressed size (file system size) is 7725131
bytes

after dovecot panic it's automatically renamed to 
1386527120.M104960P2012.mail,S=7739837:2,S by dovecot

dovecot -n

# OS: Linux 2.6.32-5-amd64 x86_64 Debian 6.0.3
auth_cache_size = 10 M
auth_cache_ttl = 1 days
auth_mechanisms = plain login
auth_username_chars = abcdefghijklmnopqrstuvwxyz01234567890.-_@
disable_plaintext_auth = no
hostname = pop.olsns.net
log_path = /usr/local/log/dovecot.log
mail_fsync = never
mail_gid = mail
mail_plugins = " zlib"
mail_uid = exim
mailbox_list_index = yes
maildir_very_dirty_syncs = yes
namespace inbox {
   inbox = yes
   location =
   mailbox Drafts {
     auto = subscribe
     special_use = \Drafts
   }
   mailbox Junk {
     auto = subscribe
     special_use = \Junk
   }
   mailbox Sent {
     auto = subscribe
     special_use = \Sent
   }
   mailbox Trash {
     auto = subscribe
     special_use = \Trash
   }
   prefix =
}
passdb {
   args = /usr/local/etc/dovecot/dovecot-sql.conf
   driver = sql
}
plugin {
   zlib_save = gz
   zlib_save_level = 6
}
pop3_fast_size_lookups = yes
protocols = imap pop3
service auth {
   user = root
}
service imap-login {
   executable = /usr/local/libexec/dovecot/imap-login
   inet_listener imap {
     address = 82.98.162.142 127.0.0.1
   }
   service_count = 100
   user = dovecot
}
service imap {
   service_count = 100
}
service pop3-login {
   executable = /usr/local/libexec/dovecot/pop3-login
   inet_listener pop3 {
     address = 82.98.162.142
   }
   service_count = 100
   user = dovecot
}
service pop3 {
   executable = /usr/local/libexec/dovecot/pop3
   service_count = 100
}
ssl_cert = </usr/local/etc/dovecot/dovecot.pem
ssl_key = </usr/local/etc/dovecot/dovecot.key
userdb {
   driver = prefetch
}
protocol pop3 {
   pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
   pop3_uidl_format = %08Xu%08Xv
}
protocol imap {
   mail_plugins = " zlib imap_zlib"
}


More information about the dovecot mailing list