If Cyrus won’t run two imapd processes on different IPs, What’s In A Name?

Posted on September 9th, 2008 by whinger. Filed under Tech, Web Development.


I couldn’t find a solution to this for the first few web searches I ran, so hopefully this will provide answers to anyone also searching for the same problem!

I run Cyrus because it seems like the best solution for a) supporting folders containing subfolders and emails, b) providing email accounts to many users without needing system logins and c) NTLM support.

Due to reasons I won’t go into now I had to restrict the imap process only to run on one of the server’s IPs; however I also need to access it from localhost for some of the server processes.

Now the recommended way to run the cyrus daemon on multiple specific IPs appears to be to tell the master process to run two different daemons, one on each IP.

So I had in cyrus.conf

imap              cmd="imapd -U 30" listen="myhostname:imap" prefork=1 maxchild=100

imap-lh           cmd="imapd -U 30" listen="localhost:imap" prefork=1 maxchild=100

The problem was, as soon as I enabled this second line, cyrus went into complete meltdown – connecting on one of the IPs just hung and eventually timed out (and it seemed to be randomly chosen at restart whether it’s the local or public IP which fails).

I finally found a posting in the cyrus mailing list (lists.andrew.cmu.edu), which has had no responses (typical) and explains it: there’s a bug in the cyrus code which figures out the lockfile name – for some reason (probably to stop people using invalid characters) it just stops at the first alphanumeric character so both daemons were using the same lock file.

So the “random” element was just whichever one connected second: renaming the second daemon to “imaplh” solves the problem.

Hope this helps someone!

Tags: , , , , , ,



Trackback URI | Comments RSS

Leave a Reply


Blogroll

Categories