1

Topic: Dovecot, slow dict lookup

==== Required information ====
- iRedMail version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Linux/BSD distribution name and version:
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version: 0.8.4
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Linux/BSD distribution name and version: Debian Squeeze
- Related log if you're reporting an issue:
====

Hi

We are seeing lines like these in /var/log/dovecot.log:
IMAP(mmh@bellcom.dk): Warning: read(/var/run/dovecot/dict-server): dict lookup took 23 seconds
IMAP(xxx@bellcom.dk): Error: read(/var/run/dovecot/dict-server) failed: Timeout after 30 seconds

The error seems to cause a timeout in the client. The amount of warning and errors seems to increase - maybe as we get more users. It is worst during office hours where we have the most mail traffic.

Any ideas what could be wrong?

Is the dict server only related to quota? We don't really use quota, so is there an easy way to disable it?

Output of dovecot -n here:
-----------
# OS: Linux 2.6.32-5-amd64 x86_64 Debian 6.0.7
log_path: /var/log/dovecot.log
protocols: pop3 pop3s imap imaps managesieve
listen(default): *
listen(imap): *
listen(pop3): *
listen(managesieve): 127.0.0.1:4190
ssl_ca_file: /etc/ssl/private/bellcom.dk_13_02_2013/AlphaSSL-Intermediate-Certificate.crt
ssl_cert_file: /etc/ssl/private/bellcom.dk_13_02_2013/bellcom.dk.crt
ssl_key_file: /etc/ssl/private/bellcom.dk_13_02_2013/bellcom.dk.key
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
login_processes_count: 4
login_max_processes_count: 256
login_max_connections: 512
max_mail_processes: 1024
mail_max_userip_connections(default): 20
mail_max_userip_connections(imap): 20
mail_max_userip_connections(pop3): 10
mail_max_userip_connections(managesieve): 10
first_valid_uid: 1004
last_valid_uid: 1004
mail_uid: 1004
mail_gid: 1004
mail_location: maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
mail_debug: yes
mbox_write_locks: fcntl dotlock
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_process_size: 1024
mail_plugins(default): quota imap_quota autocreate
mail_plugins(imap): quota imap_quota autocreate
mail_plugins(pop3): quota
mail_plugins(managesieve):
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
imap_client_workarounds(default): tb-extra-mailbox-sep
imap_client_workarounds(imap): tb-extra-mailbox-sep
imap_client_workarounds(pop3):
imap_client_workarounds(managesieve):
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
pop3_client_workarounds(managesieve):
namespace:
  type: private
  separator: .
  prefix: INBOX.
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  postmaster_address: root
  auth_socket_path: /var/run/dovecot/auth-master
  mail_plugins: quota sieve autocreate
  sieve_global_path: /var/vmail/sieve/dovecot.sieve
  log_path: /var/log/sieve.log
auth default:
  mechanisms: plain login
  default_realm: mmh.dk
  user: vmail
  passdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  userdb:
    driver: ldap
    args: /etc/dovecot/dovecot-ldap.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/dovecot-auth
      mode: 438
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 438
      user: vmail
      group: vmail
plugin:
  quota_warning: storage=85%% /usr/local/bin/dovecot-quota-warning.sh 85
  quota_warning2: storage=90%% /usr/local/bin/dovecot-quota-warning.sh 90
  quota_warning3: storage=95%% /usr/local/bin/dovecot-quota-warning.sh 95
  quota: dict:user::proxy::quotadict
  quota_rule: *:storage=0
  expire: Trash 7 Trash/* 7 Junk 30
  expire_dict: proxy::expire
  auth_socket_path: /var/run/dovecot/auth-master
  sieve: /var/vmail/sieve/%Ld/%Ln/dovecot.sieve
  autocreate: INBOX
  autocreate2: INBOX.Sent
  autocreate3: INBOX.Trash
  autocreate4: INBOX.Drafts
  autocreate5: INBOX.Junk
  autosubscribe: INBOX
  autosubscribe2: INBOX.Sent
  autosubscribe3: INBOX.Trash
  autosubscribe4: INBOX.Drafts
  autosubscribe5: INBOX.Junk
  acl: vfile
  acl_shared_dict: proxy::acl
  sieve: /var/vmail/sieve/%Ld/%Ln/dovecot.sieve
  sieve_dir: /var/vmail/sieve/%Ld/%Ln
dict:
  expire: db:/var/lib/dovecot/expire/expire.db
  quotadict: mysql:/etc/dovecot/dovecot-used-quota.conf
  acl: mysql:/etc/dovecot/dovecot-share-folder.conf
-----------

Is this the correct version?
-----------
iredmail:~# cat /etc/dovecot/dovecot-used-quota.conf
#
# File generated by iRedMail (2011.06.23.17.32.44):
#
# Version:  0.7.2
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

connect = host=127.0.0.1 dbname=iredadmin user=iredadmin password=xxx
map {
    pattern = priv/quota/storage
    table = used_quota
    username_field = username
    value_field = bytes
}
map {
    pattern = priv/quota/messages
    table = used_quota
    username_field = username
    value_field = messages
}
-----------

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Dovecot, slow dict lookup

Try to disable "expire" plugin in dovecot.conf to reduce Dovecot dict server workload with below steps:

*) Comment out "expire =" like below:

dict {
    #expire = db:...
}

*) Comment out "expire" plugin related settings in dovecot.conf like below:

plugin {
    ...
    #expire = Trash 7 Trash/* 7 Junk 30
    #expire_dict = proxy::expire
    ...
}

*) Restart Dovecot service, and see whether it happens again.

WARNING: Please do replace sensitive info before pasting config files. e.g. password.

3

Re: Dovecot, slow dict lookup

Thanks.
I have tried what you suggested, and will watch the logs.

Thanks for the edit too smile. Totally missed the sensitive info (its changed now)