LMDB reader leak with Cyrus IMAP + SASL

Dag-Erling Smørgrav <[email protected]> Fri, 05 Jun 2026 15:25:25 +0200
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
Cyrus IMAP 3.8.6, Cyrus SASL 2.1.28, LMDB 0.9.35 on FreeBSD 14.4.

I'm using auxprop, not saslauthd.  I recently switched my sasldb from
BDB to LMDB.  Since then, every couple of days the IMAP server stops
authenticating clients until I restart it.  Each attempt to connect
results in the following log messages on the server:

    imaps[85496]: SASL unable to open MDB transaction: MDB_READERS_FULL: En=
vironment maxreaders limit reached
    imaps[85496]: badlogin: redacted [redacted] plaintext (des) [SASL(-1): =
generic failure: checkpass failed]

The database has 128 registered readers, which I assume is the limit:

    # mdb_stat -rn /usr/local/etc/sasldb2 | wc -l
         128

However, there are only three active imaps processes:

    # fstat /usr/local/etc/sasldb2*
    USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W N=
AME
    cyrus    imapd      79119   10 /        132265 -rw-r-----   32768  r  /=
usr/local/etc/sasldb2
    cyrus    imapd      79119   11 /        131427 -rw-r-----    8192 rw  /=
usr/local/etc/sasldb2-lock
    cyrus    imapd      79186   10 /        132265 -rw-r-----   32768  r  /=
usr/local/etc/sasldb2
    cyrus    imapd      79186   11 /        131427 -rw-r-----    8192 rw  /=
usr/local/etc/sasldb2-lock
    cyrus    imapd      79200   10 /        132265 -rw-r-----   32768  r  /=
usr/local/etc/sasldb2
    cyrus    imapd      79200   11 /        131427 -rw-r-----    8192 rw  /=
usr/local/etc/sasldb2-lock
    # ps -xU cyrus
      PID TT  STAT    TIME COMMAND
    56124  -  SsJ  0:01.48 /usr/local/cyrus/libexec/master -d
    56127  -  SJ   0:02.07 idled
    56129  -  IJ   0:00.01 notifyd
    79119  -  IJ   0:00.43 imapd: imaps: [redacted] des re.dac.ted Idle (im=
apd)
    79186  -  IJ   0:24.63 imapd: imaps: redacted [redacted] des re.dac.ted=
  (imapd)
    79200  -  IJ   0:00.37 imapd: imaps: redacted [redacted] des re.dac.ted=
 Idle (imapd)
    85835  -  SJ   0:00.02 lmtpd

All the readers match past or present imaps processes.  There is no sign
in the logs to suggest that any of them met an abnormal fate.

Restarting imapd immediately clears up the issue:

    # service imapd restart
    Stopping cyrus_imapd.
    Waiting for PIDS: 56124.
    Starting cyrus_imapd.
    # mdb_stat -rn /usr/local/etc/sasldb2 | wc -l
           2

DES
--=20
Dag-Erling Sm=C3=B8rgrav - [email protected]

------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/Ta8a8ec710afb50b8-M395b35=
9001925baae8393796
Delivery options: https://cyrus.topicbox.com/groups/info/subscription