Disabling the reuse timeout (-T 0) results in crashes

Jens Erat jens.erat at uni-konstanz.de
Thu Feb 18 07:13:11 EST 2016

Dear Cyrus developers,

`man imapd` explains `-T 0` should disable the reuse timeout:

> −T timeout
> The number of seconds that the process will wait for a new connection before shutting down. Note that a value of 0 (zero) will disable the timeout. The default is 60.

But doing so results in crashes immediately after the first connection
with an arithmetic exception. Digging deeper, the issue is rather obvious:

    reuse_timeout = reuse_timeout + (rand() % reuse_timeout);

This should not be executed for `reuse_timeout == 0`. I attached a small
patch resolving the issue. `reuse_timeout = 0` results in disabled
alarms, probably this border case was overlooked when the random timeout
skew was added.

The patch is developed against Cyrus IMAP 2.5.7.

Regards from Lake Constance, Germany,
Jens Erat

Jens Erat
Universität Konstanz
Kommunikations-, Infomations-, Medienzentrum (KIM)
Abteilung Basisdienste
D-78457 Konstanz
Mail: jens.erat at uni-konstanz.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyrus-imapd-2.5.7-master-timeout.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20160218/c3474d7d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20160218/c3474d7d/attachment.sig>

More information about the Cyrus-devel mailing list