[Dovecot] quota rewrite patch

Paweł Panek pawel.panek at inet.pl
Mon Nov 12 13:04:25 EET 2007


I see, I have some problem with this patch no matter which version I use. 
I've tried 1.0.2, 1.0.5 and 1.0.7 and it always fails in the same point.

dovecot.log says:
Nov 12 11:38:41 Error: child 27295 (imap) killed with signal 11

It happens on FETCH command, other commands seems to work ok. I've noticed 
that if maildirsize is absent it should be rebuilt after FETCH command. It 
works well on unpachted version.
My OS is Debian Stable on x86. Maildirs are on NFS (Linux server).
Configure command was:
./configure --prefix=/var/dovecot --with-ioloop=epoll --with-sql-drivers --with-sql 
 --with-mysql --with-notify=inotify --without-pop3d

and result of configure was:
Install prefix ...................... : /var/dovecot
File offsets ........................ : 64bit
I/O loop method ..................... : epoll
File change notification method ..... : inotify
Building with SSL support ........... : yes (OpenSSL)
Building with IPv6 support .......... : yes
Building with pop3 server ........... : no
Building with mail delivery agent  .. : yes
Building with GSSAPI support ........ : no
Building with user database modules . : static prefetch passwd passwd-file 
checkpassword sql (modules)
Building with password lookup modules : passwd passwd-file shadow pam 
checkpassword sql (modules)
Building with SQL drivers ............: mysql

# ./dovecot -n
# 1.0.7: /var/dovecot/etc/dovecot.conf
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot/dovecot.log
info_log_path: /var/log/dovecot/dovecot_info.log
protocols: imap
listen: 80.xx.xx.xx:10143
ssl_disable: yes
disable_plaintext_auth: no
login_dir: /var/run/dovecot//login
login_executable: /var/dovecot/libexec/dovecot/imap-login
login_user: dovecotlogin
login_greeting: Hello IMAP.
verbose_proctitle: yes
first_valid_uid: 1000
last_valid_uid: 1000
first_valid_gid: 1000
last_valid_gid: 1000
mail_location: maildir:%h/Maildir
mail_cache_min_mail_count: 20
mail_debug: yes
mmap_disable: yes
mmap_no_write: yes
fsync_disable: yes
maildir_copy_with_hardlinks: yes
maildir_copy_preserve_filename: yes
mail_drop_priv_before_exec: yes
mail_plugins: quota imap_quota
imap_client_workarounds: outlook-idle delay-newmail
namespace:
  type: private
  separator: /
  inbox: yes
auth default:
  mechanisms: plain login
  user: dovecotauth
  verbose: yes
  debug: yes
  debug_passwords: yes
  passdb:
    driver: sql
    args: /var/dovecot/etc/dovecot-sql.conf
  userdb:
    driver: prefetch
userdb:
    driver: sql
    args: /var/dovecot/etc/dovecot-sql.conf
plugin:
  quota: maildir
  quota_rule: *:storage=1G

Query from dovecot-sql.conf
password_query = SELECT id as user, crypt as password, home as userdb_home, 
uid as userdb_uid, gid as userdb_gid FROM users WHERE id = '%u' AND 
mbox_host = '' AND active = 1

When starting:
# ./dovecot
ILoading modules from directory: /var/dovecot/lib/dovecot/imap
IModule loaded: /var/dovecot/lib/dovecot/imap/lib10_quota_plugin.so
IModule loaded: /var/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so
IEffective uid=65534, gid=65534, home=
IQuota rule: root= mailbox= storage=1048576kB messages=0

After crash:
# gdb /var/dovecot/libexec/dovecot/imap /var/core/27295
(...)
Core was generated by `imap [user 80.xx.xx.xx]'.
Program terminated with signal 11, Segmentation fault.
(...)
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from 
/var/dovecot/lib/dovecot/imap/lib10_quota_plugin.so...done.
Loaded symbols for /var/dovecot/lib/dovecot/imap/lib10_quota_plugin.so
Reading symbols from 
/var/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so...done.
Loaded symbols for /var/dovecot/lib/dovecot/imap/lib11_imap_quota_plugin.so
#0  0xac4d006a in quota_mailbox_transaction_commit (ctx=0x80f3978, flags=0) 
at quota-storage.c:75
75                      if (qt->tmp_mail != NULL)
(gdb) bt full
#0  0xac4d006a in quota_mailbox_transaction_commit (ctx=0x80f3978, flags=0) 
at quota-storage.c:75
        qbox = (struct quota_mailbox *) 0x80e3ae8
        qt = (struct quota_transaction_context *) 0x0
#1  0x0809f860 in mailbox_transaction_commit (_t=0x0, flags=0) at 
mail-storage.c:506
        t = (struct mailbox_transaction_context *) 0xac60331c
#2  0x080619a2 in imap_sync_deinit (ctx=0x80f2618) at imap-sync.c:73
        status = {messages = 1, recent = 0, unseen = 0, uidvalidity = 
1194822313, uidnext = 2,
  first_unseen_seq = 0, keywords = 0x80e2e1c, keywords__type = 0x0}
        ret = 135121152
#3  0x08057ead in cmd_idle_continue (cmd=0x0) at cmd-idle.c:194
        client = (struct client *) 0x80dc900
        ctx = (struct cmd_idle_context *) 0x80deb88
#4  0x08058020 in cmd_idle (cmd=0x80dc948) at cmd-idle.c:275
        client = (struct client *) 0x80dc900
        ctx = (struct cmd_idle_context *) 0x80deb88
        str = 0x0
        interval = 2891985692
#5  0x0805b4e5 in client_handle_input (cmd=0x80dc948) at client.c:344
        client = (struct client *) 0x80dc900
#6  0x0805b45b in client_handle_input (cmd=0x80dc948) at client.c:398
        client = (struct client *) 0x80dc900
#7  0x0805b5cd in _client_input (context=0x80dc900) at client.c:441
        client = (struct client *) 0x80dc900
        cmd = (struct client_command_context *) 0x80dc948
        ret = 2
#8  0x080b3b00 in io_loop_handler_run (ioloop=0x80dcab8) at 
ioloop-epoll.c:203
        ctx = (struct ioloop_handler_context *) 0x80da8e0
        list = (struct io_list *) 0x80dcad8
        io = (struct io *) 0x80dcab8
        tv = {tv_sec = 9, tv_usec = 979812}
        events_count = 4
        t_id = 2
        msecs = 2
        ret = 1
        i = 0
        j = 0
        call = 192
#9  0x080b3058 in io_loop_run (ioloop=0x80da8b8) at ioloop.c:329
No locals.
#10 0x08063c7d in main (argc=3, argv=0x0, envp=0x0) at main.c:290
No locals.
(gdb)

I see that segfault is caused by uninitialized (deleted?) qt variable, but I 
have no skills to trace it.
If you want more info please ask, I'll do my best.
Pawel



More information about the dovecot mailing list