imapd never times out? Is this a bug?

Lockywolf <[email protected]> Fri, 31 Jul 2026 22:51:04 -0400
Newsgroups gmane.mail.imap.cyrus
Message-ID <[email protected]>
--17855526641.d900D33e7.35250
Date: Fri, 31 Jul 2026 22:51:04 -0400
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I am using cyrus 3.12.0

I am the only user of the server, so overload is not an issue, but memory i=
s.=C2=A0
Recently I found that my server is meeting a lot of OOMs, and found this FA=
Q entry:

https://www.cyrusimap.org/imap/reference/faqs/o-toomanyprocesses.html

Okay, I don't need even remotely so many processes, so I added the followin=
g settings:

1. imapd.conf

cp_keepalive: 1
cp_keepalive_cnt: 3
cp_keepalive_idle: 15
cp_keepalive_intvl: 15

2. cyrus.conf

imaps=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cmd=3D"imapd -s -U 2 =
-T 30" listen=3D"imaps" prefork=3D0 maxchild=3D5

I expected cyrus to be able to maintain 10 connections like this.

I have three clients: two desktop machines, and a smartphone with a k9-mail=
 (thunderbird mobile).

Now none of my clients are able to connect. The attempt fails on trying to =
establish a TLS connecttion.
Restarting cyrus solves the issue temporarily, but I don't want to restart =
cyrus (do manual garbage collection) every hour.

Is this an issue, or am I missing some config parameter?

The output of ss --tcp | grep imaps

CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:370=
18
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:404=
44
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:415=
50
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:421=
46
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:425=
24
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:437=
14
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:449=
48
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:450=
04
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:450=
12
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:479=
08
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:488=
90
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:33372
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:37448
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:42248
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:45768
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:59704
ESTAB      0      0                               server.ipv4:imaps        =
                              cnat.ipv4:4217
ESTAB      0      0      [0000::serv:ipv6]:imaps       [0000:lap:top:ipv6]:=
35222
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:390=
70
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:412=
46
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:474=
80
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:479=
22
ESTAB      517    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:437=
34
ESTAB      517    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:50438

That's 22 connections.
1. Why are there so many?
I expected to have one connection per device.

2. Does the -U option count different connections from the same device (IDL=
E) as different connections?

3. Why are the connections refused? I expected cyrus, if it is lacking reso=
urces (the -U option), to evict older clients to give way to the new ones. =
Is it doing something else?

4. Why are there so many connections "CLOSE-WAIT"?

------------------------------------------
Cyrus: Info
Permalink: https://cyrus.topicbox.com/groups/info/T22ff1c7d14d4cd97-Mb30cc5=
9c1fbdc685ea733e7e
Delivery options: https://cyrus.topicbox.com/groups/info/subscription

--17855526641.d900D33e7.35250
Date: Fri, 31 Jul 2026 22:51:04 -0400
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html><html><html><body><div>I am using cyrus 3.12.0<br /></div><div><br />=
</div><div>I am the only user of the server, so overload is not an issue, b=
ut memory is.&nbsp;<br /></div><div>Recently I found that my server is meet=
ing a lot of OOMs, and found this FAQ entry:<br /></div><div><br /></div><d=
iv><a href=3D"https://www.cyrusimap.org/imap/reference/faqs/o-toomanyproces=
ses.html">https://www.cyrusimap.org/imap/reference/faqs/o-toomanyprocesses.=
html</a><br /></div><div><br /></div><div>Okay, I don&#39;t need even remot=
ely so many processes, so I added the following settings:<br /></div><div><=
br /></div><div>1. imapd.conf<br /></div><div><br /></div><pre style=3D"mar=
gin:7px 0;border-radius:3px;border:1px solid #ccc;padding:7px 10px;backgrou=
nd:#f6f6f6;font-family:menlo,consolas,monospace;font-size:90%;white-space:p=
re-wrap;word-wrap:break-word;overflow-wrap:break-word;">cp_keepalive: 1
cp_keepalive_cnt: 3
cp_keepalive_idle: 15
cp_keepalive_intvl: 15<br /></pre><div><br /></div><div>2. cyrus.conf<br />=
</div><div><br /></div><div><code style=3D"border-radius:3px;border:1px sol=
id #ccc;padding:1px 3px;background:#f6f6f6;font-family:menlo,consolas,monos=
pace;font-size:90%;">imaps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
cmd=3D&quot;imapd -s -U 2 -T 30&quot; listen=3D&quot;imaps&quot; prefork=3D=
0 maxchild=3D5</code><br /></div><div><br /></div><div>I expected cyrus to =
be able to maintain 10 connections like this.</div><div><br /></div><div>I =
have three clients: two desktop machines, and a smartphone with a k9-mail (=
thunderbird mobile).<br /></div><div><br /></div><div>Now none of my client=
s are able to connect. The attempt fails on trying to establish a TLS conne=
cttion.<br /></div><div>Restarting cyrus solves the issue temporarily, but =
I don&#39;t want to restart cyrus (do manual garbage collection) every hour=
.<br /></div><div><br /></div><div>Is this an issue, or am I missing some c=
onfig parameter?<br /></div><div><br /></div><div>The output of <code style=
=3D"border-radius:3px;border:1px solid #ccc;padding:1px 3px;background:#f6f=
6f6;font-family:menlo,consolas,monospace;font-size:90%;">ss --tcp | grep im=
aps</code></div><div><br /></div><pre style=3D"margin:7px 0;border-radius:3=
px;border:1px solid #ccc;padding:7px 10px;background:#f6f6f6;font-family:me=
nlo,consolas,monospace;font-size:90%;white-space:pre-wrap;word-wrap:break-w=
ord;overflow-wrap:break-word;">CLOSE-WAIT 518    0      [0000::serv:ipv6]:i=
maps       [000::k9ma:ipv6]:37018
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:404=
44
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:415=
50
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:421=
46
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:425=
24
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:437=
14
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:449=
48
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:450=
04
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:450=
12
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:479=
08
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:488=
90
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:33372
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:37448
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:42248
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:45768
CLOSE-WAIT 518    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:59704
ESTAB      0      0                               server.ipv4:imaps        =
                              cnat.ipv4:4217
ESTAB      0      0      [0000::serv:ipv6]:imaps       [0000:lap:top:ipv6]:=
35222
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:390=
70
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:412=
46
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:474=
80
ESTAB      0      0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:479=
22
ESTAB      517    0      [0000::serv:ipv6]:imaps       [000::k9ma:ipv6]:437=
34
ESTAB      517    0      [0000::serv:ipv6]:imaps       [0001:lap:top2:ipv6]=
:50438</pre><div><br /></div><div>That&#39;s 22 connections.<br /></div><di=
v>1. Why are there so many?<br /></div><div>I expected to have one connecti=
on per device.<br /></div><div><br /></div><div>2. Does the -U option count=
 different connections from the same device (IDLE) as different connections=
?<br /></div><div><br /></div><div>3. Why are the connections refused? I ex=
pected cyrus, if it is lacking resources (the -U option), to evict older cl=
ients to give way to the new ones. Is it doing something else?<br /></div><=
div><br /></div><div>4. Why are there so many connections &quot;CLOSE-WAIT&=
quot;?<br /></div><div><br /></div><div id=3D"topicbox-footer" style=3D"mar=
gin:10px 0 0;border-top:1px solid #ddd;border-color:rgba(0,0,0,.15);padding=
:7px 0;">

<strong><a href=3D"https://cyrus.topicbox.com/latest" style=3D"color:inheri=
t;text-decoration:none">Cyrus</a></strong>
  / Info / see
<a href=3D"https://cyrus.topicbox.com/groups/info">discussions</a>
  +
<a href=3D"https://cyrus.topicbox.com/groups/info/members">participants</a>
  +
<a href=3D"https://cyrus.topicbox.com/groups/info/subscription">delivery&nb=
sp;options</a>
<a href=3D"https://cyrus.topicbox.com/groups/info/T22ff1c7d14d4cd97-Mb30cc5=
9c1fbdc685ea733e7e" style=3D"float:right">Permalink</a>
</div>
</body></html></html></html>=

--17855526641.d900D33e7.35250--