imap_metadata plugin panic

Elisamuel Resto sam at samresto.dev
Mon Nov 15 18:27:23 UTC 2021


Hello,

This may be covered somewhere but recently I enabled the metadata plugin 
to work with sieve as part of some updates I did a while back and I 
hadn't checked my logs for any issues with it and so far they're not 
completely taking my system down.

Right now, upon trying to delete a folder I noticed the following in my 
logs... what am I missing? I see the broken SQL query, but I don't know 
enough about the dict system or the metadata plugin to know how to add 
the missing information or fix it otherwise.

Regards,
Elisamuel Resto


Nov 15 12:19:19 wyvern dovecot[461]: dict(51438): Panic: lib-sql: Too 
many bind args (2) for statement: SELECT meta_key FROM metadata WHERE 
meta_key LIKE  AND username = ?
Nov 15 12:19:19 wyvern dovecot[461]: dict(51438): Error: Raw backtrace: 
/usr/lib/dovecot/libdovecot.so.0(backtrace_append+0x43) [0x7f449789d073] 
-> /usr/lib/dovecot/libdovecot.so.0(backtrace_get+0x20) [0x7f449789d190] 
-> /usr/lib/dovecot/libdovecot.so.0(+0xfaf1f) [0x7f44978a9f1f] -> 
/usr/lib/dovecot/libdovecot.so.0(+0xfafb1) [0x7f44978a9fb1] -> 
/usr/lib/dovecot/libdovecot.so.0(+0x4cd20) [0x7f44977fbd20] -> 
dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 iters:0/0/0/0, 0 
commits:0/0/0/0](+0x875a) [0x555e60d7775a] -> dovecot/dict [0 clients, 0 
lookups:0/0/0/0, 0 iters:0/0/0/0, 0 
commits:0/0/0/0](sql_statement_query+0x42) [0x555e60d7f262] -> 
dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 iters:0/0/0/0, 0 
commits:0/0/0/0](+0xd97f) [0x555e60d7c97f] -> 
/usr/lib/dovecot/libdovecot.so.0(dict_iterate_values+0x25) 
[0x7f4497868615] -> dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 
iters:0/0/0/0, 0 commits:0/0/0/0](+0xa929) [0x555e60d79929] -> 
dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 iters:0/0/0/0, 0 
commits:0/0/0/0](+0xb224) [0x555e60d7a224] -> dovecot/dict [0 clients, 0 
lookups:0/0/0/0, 0 iters:0/0/0/0, 0 commits:0/0/0/0](+0xb381) 
[0x555e60d7a381] -> dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 
iters:0/0/0/0, 0 commits:0/0/0/0](dict_command_input+0xd9) 
[0x555e60d7a579] -> dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 
iters:0/0/0/0, 0 commits:0/0/0/0](+0x95b8) [0x555e60d785b8] -> 
/usr/lib/dovecot/libdovecot.so.0(connection_input_default+0x15e) 
[0x7f44978a16ce] -> 
/usr/lib/dovecot/libdovecot.so.0(io_loop_call_io+0x6b) [0x7f44978bfebb] 
-> /usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run_internal+0x13b) 
[0x7f44978c15cb] -> 
/usr/lib/dovecot/libdovecot.so.0(io_loop_handler_run+0x51) 
[0x7f44978bff61] -> /usr/lib/dovecot/libdovecot.so.0(io_loop_run+0x41) 
[0x7f44978c0131] -> 
/usr/lib/dovecot/libdovecot.so.0(master_service_run+0x14) 
[0x7f4497831f74] -> dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 
iters:0/0/0/0, 0 commits:0/0/0/0](main+0x189) [0x555e60d78139] -> 
/usr/lib/libc.so.6(__libc_start_main+0xd5) [0x7f44972cfb25] -> 
dovecot/dict [0 clients, 0 lookups:0/0/0/0, 0 iters:0/0/0/0, 0 
commits:0/0/0/0](_start+0x2e) [0x555e60d7819e]
Nov 15 12:19:19 wyvern dovecot[461]: 
imap(sam at samresto.dev)<51449><+BGq2NfQM/7Pisr9>: Error: Mailbox 
Trash/Processed: dict_iterate(priv/c841ad0291c27461ac670100a07d9965/) 
failed: Connection closed (reply took 0.204 secs (0.204 in dict wait, 
0.000 in other ioloops, 0.000 in locks))
Nov 15 12:19:19 wyvern dovecot[461]: dict(51438): Fatal: master: 
service(dict): child 51438 killed with signal 6 (core dumped)

-------------- next part --------------
[root at wyvern ~]# dovecot -n
# 2.3.16 (7e2e900c1a): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.16 (09c29328)
# OS: Linux 5.14.16-arch1-1 x86_64  ext4
# Hostname: wyvern.simplysam.us
auth_mechanisms = plain login
dict {
  lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  metadata = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  quota_clone = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
doveadm_worker_count = 5
first_valid_gid = 5000
first_valid_uid = 5000
imap_client_workarounds = delay-newmail tb-extra-mailbox-sep tb-lsub-flags
last_valid_gid = 5000
last_valid_uid = 5000
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
lda_original_recipient_header = X-Original-To
lmtp_client_workarounds = whitespace-before-path
lmtp_rcpt_check_quota = yes
lmtp_save_to_detail_mailbox = yes
mail_attachment_detection_options = add-flags-on-save
mail_attribute_dict = proxy::metadata
mail_gid = 5000
mail_home = /var/mail/virtual/%Ld/%Ln
mail_location = maildir:/var/mail/virtual/%Ld/%Ln
mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve"
mail_uid = 5000
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext spamtestplus virustest vnd.dovecot.pipe vnd.dovecot.filter
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    auto = subscribe
    special_use = \Archive
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    special_use = \Sent
  }
  mailbox Spam {
    auto = subscribe
    autoexpunge = 30 days
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    autoexpunge = 90 days
    special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  antispam_backend = pipe
  antispam_pipe_program = /usr/local/sbin/sa-learn-pipe
  antispam_pipe_program_notspam_arg = --ham
  antispam_pipe_program_spam_arg = --spam
  antispam_pipe_tmpdir = /tmp
  antispam_spam = Junk;Spam
  antispam_trash = trash;Trash;Deleted Items;Deleted Messages
  fts = flatcurve
  fts_autoindex = yes
  fts_autoindex_exclude = \Spam
  fts_autoindex_exclude2 = \Trash
  fts_enforced = yes
  fts_flatcurve = commit_limit=500 max_term_size=30 min_term_size=2 optimize_limit=10 rotate_size=5000 rotate_time=5000 substring_search=yes
  fts_languages = en es
  fts_tokenizer_generic = algorithm=simple
  fts_tokenizers = generic email-address
  imapsieve_mailbox1_after = file:/var/lib/dovecot/sieve/report-spam.sieve
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_name = Junk
  imapsieve_mailbox2_after = file:/var/lib/dovecot/sieve/report-spam.sieve
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_name = Spam
  imapsieve_mailbox3_after = file:/var/lib/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox3_causes = COPY
  imapsieve_mailbox3_from = Junk
  imapsieve_mailbox3_name = *
  imapsieve_mailbox4_after = file:/var/lib/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox4_causes = COPY
  imapsieve_mailbox4_from = Spam
  imapsieve_mailbox4_name = *
  imapsieve_mailbox5_after = file:/var/lib/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox5_causes = COPY
  imapsieve_mailbox5_name = Archive
  imapsieve_url = sieve://wyvern.example.com:4190
  last_login_dict = proxy::lastlogin
  last_login_key = # hidden, use -P to show it
  mailbox_alias_new = Sent Messages
  mailbox_alias_new2 = Sent Items
  mailbox_alias_new3 = Junk
  mailbox_alias_old = Sent
  mailbox_alias_old2 = Sent
  mailbox_alias_old3 = Spam
  quota = count:User quota
  quota_clone_dict = proxy::quota_clone
  quota_grace = 10%%
  quota_max_mail_size = 30M
  quota_rule = *:storage=1G
  quota_rule2 = Trash:ignore
  quota_rule3 = Spam:ignore
  quota_status_nouser = DUNNO
  quota_status_overquota = 552 5.2.2 Mailbox is full
  quota_status_success = DUNNO
  quota_vsizes = yes
  sieve = file:~/sieve;active=~/dovecot.sieve
  sieve_before = /var/lib/dovecot/sieve.d/
  sieve_extensions = +spamtestplus +virustest +vnd.dovecot.pipe +vnd.dovecot.filter
  sieve_max_redirects = 30
  sieve_plugins = sieve_extprograms
  sieve_vacation_send_from_recipient = yes
  trash = /etc/dovecot/dovecot-trash.conf.ext
}
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_enable_last = yes
pop3_reuse_xuidl = yes
protocols = imap pop3 lmtp sieve
quota_full_tempfail = yes
service auth-worker {
  user = $default_internal_user
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
  unix_listener auth-userdb {
    mode = 0666
  }
}
service dict {
  unix_listener dict {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
  process_min_avail = 1
  service_count = 1
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
  unix_listener lmtp {
    mode = 0666
  }
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  process_min_avail = 1
  service_count = 1
}
service managesieve {
  process_limit = 20
}
service pop3-login {
  inet_listener pop3 {
    port = 110
  }
  inet_listener pop3s {
    port = 995
    ssl = yes
  }
}
service stats {
  unix_listener stats-reader {
    group = vmail
    mode = 0664
    user = vmail
  }
  unix_listener stats-writer {
    group = vmail
    mode = 0666
    user = vmail
  }
}
service submission-login {
  inet_listener submission {
    port = 587
  }
}
ssl_cert = </etc/letsencrypt/live/wyvern.example.com/fullchain.pem
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
verbose_proctitle = yes
protocol lmtp {
  auth_username_format = %Lu
  mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve sieve"
}
protocol !indexer-worker {
  mail_vsize_bg_after_count = 100
}
protocol lda {
  mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve sieve"
}
protocol imap {
  imap_metadata = yes
  mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve imap_quota last_login"
}
protocol sieve {
  mail_plugins =
}
protocol pop3 {
  mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve last_login"
}
protocol submission {
  mail_plugins = " quota quota_clone mailbox_alias trash fts fts_flatcurve"
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xD2D5FB6118615F19.asc
Type: application/pgp-keys
Size: 7818 bytes
Desc: OpenPGP public key
URL: <https://dovecot.org/pipermail/dovecot/attachments/20211115/fa3a3b9c/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://dovecot.org/pipermail/dovecot/attachments/20211115/fa3a3b9c/attachment-0001.sig>


More information about the dovecot mailing list