Bug 217364 - mail/dovecot2 bug in dovecot-lda after upgrade to 2.2.28
Summary: mail/dovecot2 bug in dovecot-lda after upgrade to 2.2.28
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-25 23:12 UTC by Max Kostikov
Modified: 2017-03-01 17:56 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (adamw)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Kostikov 2017-02-25 23:12:28 UTC
After upgrade from previous version got dovecot-lda failure with
> dovecot: lda(my@email): Panic: file mail-namespace.c: line 709 (mail_namespace_find): assertion failed: (ns != NULL)
in log file

> # uname -v
> FreeBSD 11.0-RELEASE-p8 #0: Wed Feb 22 06:12:04 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
Comment 1 Adam Weinberger freebsd_committer freebsd_triage 2017-02-26 00:05:15 UTC
Did you build this yourself, or is this from the package? If you're building it yourself, which options do you have set?
Comment 2 Max Kostikov 2017-02-26 09:34:37 UTC
I bulid it from ports.
Here is my standard config
# make showconfig
===> The following configuration options are available for dovecot2-2.2.28:
     DOCS=on: Build and/or install documentation
     EXAMPLES=on: Build and/or install examples
     KQUEUE=on: kqueue(2) support
     LIBWRAP=on: TCP wrapper support
     LZ4=on: LZ4 compression support
     VPOPMAIL=off: vpopmail support
====> Database support
     CDB=off: CDB database support
     LDAP=off: LDAP protocol support
     MYSQL=on: MySQL database support
     PGSQL=off: PostgreSQL database support
     SQLITE=off: SQLite database support
====> Full text search plugins
     ICU=off: Use libicu for FTS unicode normalization
     LUCENE=off: CLucene FTS support
     SOLR=off: Solr FTS support
     TEXTCAT=off: Libtextcat FTS support
====> GSSAPI Security API support: you have to select exactly one of them
     GSSAPI_NONE=off: Build without GSSAPI support
     GSSAPI_BASE=on: Use GSSAPI from base
     GSSAPI_HEIMDAL=off: Use Heimdal GSSAPI from security/heimdal
     GSSAPI_MIT=off: Use MIT GSSAPI from security/krb5
===> Use 'make config' to modify these settings
Comment 3 Adam Weinberger freebsd_committer freebsd_triage 2017-02-26 15:19:25 UTC
Those look like pretty reasonable options. I haven't been able to replicate this, and ler@ tells me he isn't seeing this on his server either.

Can you give me the output of 'doveconf -n'? Pasting it here is preferable, but if you're uncomfortable having it in bugzilla you can email it directly do me if you prefer.
Comment 4 Max Kostikov 2017-02-26 15:31:49 UTC
Sure. It's the same as it was before update.

# doveconf -n
# 2.2.27 (c0f36b0): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: FreeBSD 11.0-RELEASE-p8 amd64  ufs
auth_mechanisms = plain login
default_login_user = dovecot
dict {
  sqluserquota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql-user.conf
}
disable_plaintext_auth = no
first_valid_gid = 0
first_valid_uid = 25
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
login_access_sockets = tcpwrap
login_greeting = Dovecot ready!
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l %c
mail_access_groups = mail
mail_gid = 6
mail_location = maildir:/var/mail/%d/%n
mail_plugins = acl quota trash
mail_privileged_group = mail
mail_uid = 26
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
namespace {
  location = maildir:/var/mail/%d/.public:INDEXPVT=/var/mail/%d/%n/public
  prefix = public.
  separator = .
  subscriptions = no
  type = public
}
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 =
  separator = .
  type = private
}
passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
plugin {
  acl = vfile::cache_secs=300
  antispam_backend = mailtrain
  antispam_mail_notspam = %u-revoke
  antispam_mail_sendmail = /usr/local/etc/dovecot/move-cmd.sh
  antispam_mail_sendmail_args =
  antispam_mail_spam = %u-report
  antispam_spam = Junk
  antispam_trash = Trash
  quota = dict:user_quota::proxy::sqluserquota
  quota_grace = 10%%
  quota_rule2 = Trash:storage=+10%%
  quota_rule3 = Junk:storage=+10%%
  quota_warning = storage=100%% quota-exceeded 100 %u
  quota_warning2 = storage=95%% quota-warning 95 %u
  quota_warning3 = storage=90%% quota-warning 90 %u
  quota_warning4 = storage=75%% quota-warning 75 %u
  sieve = ~/dovecot.sieve
  sieve_before = /usr/local/etc/dovecot/default.sieve
  sieve_dir = ~/sieve
  sieve_global_path = /usr/local/etc/dovecot/default.sieve
  trash = /usr/local/etc/dovecot/dovecot-trash.conf
}
protocols = imap pop3 lmtp sieve
service auth {
  unix_listener auth-client {
    mode = 0660
    user = mailnull
  }
  unix_listener auth-master {
    mode = 0660
    user = mailnull
  }
  user = root
}
service dict {
  unix_listener dict {
    mode = 0660
    user = mailnull
  }
}
service imap-login {
  chroot = login
  client_limit = 64
  executable = /usr/local/libexec/dovecot/imap-login
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
  }
  process_limit = 32
  process_min_avail = 8
  service_count = 1
  user = $default_login_user
  vsz_limit = 64 M
}
service imap {
  executable = /usr/local/libexec/dovecot/imap
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  process_min_avail = 1
  service_count = 1
  user = $default_login_user
  vsz_limit = 64 M
}
service managesieve {
  process_limit = 10
}
service pop3-login {
  chroot = login
  client_limit = 64
  executable = /usr/local/libexec/dovecot/pop3-login
  inet_listener pop3 {
    port = 110
  }
  inet_listener pop3s {
    port = 995
  }
  process_limit = 32
  process_min_avail = 8
  service_count = 1
  user = $default_login_user
  vsz_limit = 64 M
}
service pop3 {
  executable = /usr/local/libexec/dovecot/pop3
}
service quota-warning {
  executable = script /usr/local/etc/dovecot/quota_warning.sh
  unix_listener quota-warning {
    mode = 0660
    user = mailnull
  }
}
service tcpwrap {
  unix_listener login/tcpwrap {
    mode = 0600
    user = $default_login_user
  }
}
ssl_ca = </usr/local/etc/letsencrypt/live/peek.ru/chain.pem
ssl_cert = </usr/local/etc/letsencrypt/live/peek.ru/cert.pem
ssl_cipher_list = ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
ssl_dh_parameters_length = 2048
ssl_key =  # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
userdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf
  driver = sql
}
protocol sieve {
  managesieve_implementation_string = dovecot
  managesieve_max_line_length = 65536
}
protocol imap {
  imap_client_workarounds = delay-newmail tb-extra-mailbox-sep
  mail_plugins = acl quota trash antispam imap_acl imap_quota
}
protocol lmtp {
  mail_plugins = acl quota trash sieve
}
protocol pop3 {
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  pop3_uidl_format = %08Xu%08Xv
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  mail_plugins = acl quota trash sieve
  postmaster_address = postmaster@peek.ru
  sendmail_path = /usr/sbin/sendmail
}
local_name *.domain.ru {
  ssl_ca = </usr/local/etc/letsencrypt/live/domain.ru/chain.pem
  ssl_cert = </usr/local/etc/letsencrypt/live/domain.ru/cert.pem
  ssl_key =  # hidden, use -P to show it
}
Comment 5 Adam Weinberger freebsd_committer freebsd_triage 2017-02-27 17:03:37 UTC
Your setup is pretty similar to mine, and I can't replicate the error you're getting. If your MTA supports it, try switching to LMTP. Also, do you have anything in your userdb that is overriding the namespace?

Past those, I don't know how to advise you because I haven't been able to replicate that error. I'd suggest asking on the dovecot list (https://www.dovecot.org/mailinglists.html).
Comment 6 Max Kostikov 2017-02-27 17:31:41 UTC
Well, userdb stills the same for few years I'm under Dovecot. It's using Postfixadmin user database.

# cat dovecot-sql.conf
driver = mysql
connect = host=localhost dbname=mail user=user password=pass
default_pass_scheme = BLF-CRYPT
password_query  = SELECT username AS user, password \
                  FROM mailbox WHERE username = LCASE('%u') \
                  AND active = '1'
user_query      = SELECT CONCAT('/var/mail/',LCASE(maildir)) AS home, \
                  CONCAT('*:bytes=', mailbox.quota) AS quota_rule \
                  FROM mailbox, domain \
                  WHERE username = LCASE('%u') AND mailbox.active = '1' \
                  AND domain.domain = '%d' AND domain.active = '1'
Comment 7 Max Kostikov 2017-02-27 18:52:35 UTC
It seems like something broken in Dovecot 2.2.28 namespace code (I'm using public namespaces for my domains - see config).
Comment 8 Max Kostikov 2017-02-28 11:18:37 UTC
Just sent this bug to Dovecot mailing list
http://dovecot.org/pipermail/dovecot/2017-February/107258.html
Comment 9 Max Kostikov 2017-02-28 19:01:19 UTC
Dovecot developers confirmed bug in Dovecot's Trash plugins in 2.2.28.
http://dovecot.org/pipermail/dovecot/2017-February/107269.html
Comment 10 Adam Weinberger freebsd_committer freebsd_triage 2017-03-01 04:31:39 UTC
Glad to hear it. Once an upstream fix is available I'll add the patch to the port.
Comment 11 Max Kostikov 2017-03-01 13:17:21 UTC
Aki Tuomi from Dovecot team just published patch for this issue
https://github.com/dovecot/core/commit/326fb016a23480e4ff8dcc03dc80e76812859bd6.patch
Comment 12 Adam Weinberger freebsd_committer freebsd_triage 2017-03-01 15:35:30 UTC
Have you recompiled dovecot with it? Does it fix the problem for you?
Comment 13 Max Kostikov 2017-03-01 17:36:00 UTC
Yes, after patch all works fine.
Comment 14 commit-hook freebsd_committer freebsd_triage 2017-03-01 17:56:10 UTC
A commit references this bug:

Author: adamw
Date: Wed Mar  1 17:55:58 UTC 2017
New revision: 435188
URL: https://svnweb.freebsd.org/changeset/ports/435188

Log:
  Add a patch from upstream that fixes a crash with the trash plugin:

  Panic: file mail-namespace.c: line 709 (mail_namespace_find): assertion failed: (ns != NULL)

  Bump PORTREVISION.

  PR:		217364
  Submitted by:	Max Kostikov
  Obtained from:	https://github.com/dovecot/core/commit/326fb016a23480e4ff8dcc03dc80e76812859bd6.patch

Changes:
  head/mail/dovecot2/Makefile
  head/mail/dovecot2/files/patch-trash_plugin
Comment 15 Adam Weinberger freebsd_committer freebsd_triage 2017-03-01 17:56:34 UTC
Committed. Thanks, Max.