[Dovecot] SEGV when user over filesystem quota and "Move to Trash"

Steffen Kaiser skdovecot at smail.inf.fh-bonn-rhein-sieg.de
Tue Jun 12 11:10:48 EEST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I've configured Dovecot v1.0.0 with filesystem quota and to use hardlinks.
Latter I use intentionally to save disk space and to achieve that an user 
can delete mails even if over quota and using the "Delete to Trash" 
feature.

The following happens, when the directory file of .Trash/* fills up and 
would need to be expanded, but fails because of an over-quota condition.

The crash is not so problematic, because you can wait some time (I guess 
until the lock of .Trash/dovecot-uidlist.lock expires) and you can delete 
mails from Trash to make room. However, there are leftover files in 
.Trash/tmp, what may make problems.

First you get a "Out of quota" error in the MUA, maybe a second or a third 
time, too. Then:

dovecot: Jun 12 09:10:38 Info: IMAP(dvtest) [3492]: copy -> Trash: 
uid=500, msgid=<cs-HoeqDW06gzBNu-9HdUBR4A@>
dovecot: Jun 12 09:10:38 Error: child 3492 (imap) killed with signal 11

When you try to delete another mail:

process #1:
nanosleep({0, 158957000}, NULL)         = 0
lstat64("/var/cache/dovecot/31045/control/.Trash/dovecot-uidlist.lock", 
{st_mode=S_IFREG|0600, st_size=0, ...}) = 0
time(NULL)                              = 1181630732
nanosleep({0, 170189000}, NULL)         = 0
lstat64("/var/cache/dovecot/31045/control/.Trash/dovecot-uidlist.lock", 
{st_mode=S_IFREG|0600, st_size=0, ...}) = 0
time(NULL)                              = 1181630732

process #2:
gettimeofday({1181630713, 945424}, NULL) = 0
poll([{fd=4, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=2, 
events=POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 3, 9335) = 0
gettimeofday({1181630723, 281935}, {4294967176, 0}) = 0
gettimeofday({1181630723, 282014}, NULL) = 0
poll([{fd=4, events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}, {fd=2, 
events=POLLERR|POLLHUP|POLLNVAL}, {fd=0, 
events=POLLIN|POLLPRI|POLLERR|POLLHUP|POLLNVAL}], 3, 9999) = 0
gettimeofday({1181630733, 281949}, {4294967176, 0}) = 0
gettimeofday({1181630733, 282149}, NULL) = 0

.Trash/tmp contains 28 items (growing)

After the "Connection timeout" error in the client process #1 still loops 
repeatedly. Eventually the processes stops. Maybe it is waiting for the 
release of the lock by the process killed by segv? Finally it dumps core, 
too.
dovecot: Jun 12 09:10:38 Info: IMAP(dvtest) [3821]: copy -> Trash: 
uid=500, msgid=<cs-HoeqDW06gzBNu-9HdUBR4A@>
dovecot: Jun 12 09:12:39 Error: child 3821 (imap) killed with signal 11

Core was generated by `imap [dvtest 10.20.10.63]'.
Program terminated with signal 11, Segmentation fault.
#0  maildir_sync_get_keywords_sync_ctx (ctx=0xffffffff) at 
maildir-sync.c:242
242     {
(gdb) bt
#0  maildir_sync_get_keywords_sync_ctx (ctx=0xffffffff) at 
maildir-sync.c:242
#1  0x0806ddd4 in maildir_mf_get_path (ctx=0x0, mf=0x20) at 
maildir-save.c:263
#2  0x0806de80 in maildir_transaction_unlink_copied_files (ctx=0x80fcbb0, 
pos=0x0) at maildir-save.c:477
#3  0x0806e5cb in maildir_transaction_save_commit_pre (ctx=0x80fcab0) at 
maildir-save.c:561
#4  0x080693c4 in maildir_transaction_commit (_t=0x8101eb8, flags=0) at 
maildir-transaction.c:28
#5  0xb7ddbbd0 in quota_mailbox_transaction_commit (ctx=0x8101eb8, 
flags=0) at quota-storage.c:74
#6  0x08057965 in cmd_copy (cmd=0x80df0f0) at cmd-copy.c:124
#7  0x0805b1be in cmd_uid (cmd=0x80df0f0) at cmd-uid.c:19
#8  0x0805b728 in client_handle_input (cmd=0x80df0f0) at client.c:335
#9  0x0805b7b7 in client_handle_input (cmd=0x80df0f0) at client.c:389
#10 0x0805be3c in _client_input (context=0x80df0a8) at client.c:432
#11 0x080bc902 in io_loop_handler_run (ioloop=0x80dc9b0) at 
ioloop-poll.c:199
#12 0x080bbb58 in io_loop_run (ioloop=0x80dc9b0) at ioloop.c:326
#13 0x08063e80 in main (argc=Cannot access memory at address 0x0
) at main.c:290

I also managed it to have to two processes waiting for 
/var/cache/dovecot/31045/control/.Trash/dovecot-uidlist.lock.

dovecot -n:
# /usr/local/dovecot/etc/dovecot.conf
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot/dovecot.log
protocols: imap imaps pop3 pop3s
ssl_ca_file: /etc/ssl/certs/ca.crt
ssl_cert_file(default): /etc/ssl/certs/imap.pem
ssl_cert_file(imap): /etc/ssl/certs/imap.pem
ssl_cert_file(pop3): /etc/ssl/certs/pop3.pem
ssl_key_file(default): /etc/ssl/private/imap.key
ssl_key_file(imap): /etc/ssl/private/imap.key
ssl_key_file(pop3): /etc/ssl/private/pop3.key
disable_plaintext_auth: no
verbose_ssl: yes
login_dir: /var/run/dovecot//login
login_executable(default): /usr/local/dovecot/libexec/dovecot/imap-login
login_executable(imap): /usr/local/dovecot/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3-login
login_log_format_elements: %p: user=<%u> method=%m rip=%r lip=%l %c
verbose_proctitle: yes
first_valid_uid: 1000
mail_location: 
maildir:%h/MailDir:CONTROL=/var/cache/dovecot/%i/control:INDEX=/var/cache/dovecot/%i/index
mail_debug: yes
dotlock_use_excl: yes
maildir_copy_with_hardlinks: yes
maildir_copy_preserve_filename: yes
mail_drop_priv_before_exec: yes
mail_executable(default): /usr/local/dovecot/libexec/dovecot/rawlog 
/usr/local/dovecot/libexec/dovecot/imap
mail_executable(imap): /usr/local/dovecot/libexec/dovecot/rawlog 
/usr/local/dovecot/libexec/dovecot/imap
mail_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3
mail_plugins(default): quota imap_quota mail_log zlib
mail_plugins(imap): quota imap_quota mail_log zlib
mail_plugins(pop3): quota mail_log
mail_plugin_dir(default): /usr/local/dovecot/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/dovecot/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/dovecot/lib/dovecot/pop3
mail_log_prefix: %Us(%u) [%p]:
mail_log_max_lines_per_sec: 0
pop3_uidl_format(default):
pop3_uidl_format(imap):
pop3_uidl_format(pop3): %u
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): oe-ns-eoh
namespace:
   type: private
   separator: .
   inbox: yes
   hidden: yes
auth default:
   mechanisms: plain login
   cache_size: 10
   username_chars: 
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890
   verbose: yes
   debug: yes
   passdb:
     driver: ldap
     args: /usr/local/dovecot/etc/dovecot-ldap.conf
   userdb:
     driver: ldap
     args: /usr/local/dovecot/etc/dovecot-ldap.conf
   userdb:
     driver: passwd-file
     args: /etc/passwd
   socket:
     type: listen
     client:
     master:
       path: /var/run/dovecot/auth-master
       mode: 432
       group: mail
plugin:
   quota: fs

Bye,

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQEVAwUBRm5VCi9SORjhbDpvAQLDQwgAp0Zcg4SbTXXyFTUFVsxRHjhRr1V2ZuoE
Ajpar7u5hoG8IfJ8u6noxk2XvNlD0rL0g/oXHJDeRTuZs6PVwcQpSEyQ0DNUx8BY
bUyX5i3sR02MOrwbKvlq6ynvV3VE5PY4fpgCfqUv7ZE4W72u577IQ4l/C3+hgC+Y
qzKw2URlVzoJj6apyXEIZcv4gvxkxl4mMtOmoXrTj5nMfz7EFbbuXuK9aYfFhLFp
YB/Q0FxsU3YylpYYbFGronbmrAUGb2TCJckRAwDdTzT1s++6uvbJt5BLRnwiOK6H
UAEuJJllwoDcwx0WIwMzf3SXP52OSqHdEVBuJprxpHrTI7Fe2fm5FA==
=WkkL
-----END PGP SIGNATURE-----


More information about the dovecot mailing list