{"id":16,"date":"2008-09-09T15:31:15","date_gmt":"2008-09-09T14:31:15","guid":{"rendered":"http:\/\/www.weeklywhinge.com\/?p=16"},"modified":"2008-09-09T15:31:56","modified_gmt":"2008-09-09T14:31:56","slug":"if-cyrus-wont-run-two-imapd-processes-on-different-ips-whats-in-a-name","status":"publish","type":"post","link":"https:\/\/www.weeklywhinge.com\/?p=16","title":{"rendered":"If Cyrus won&#8217;t run two imapd processes on different IPs, What&#8217;s In A Name?"},"content":{"rendered":"<p>I couldn&#8217;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!<\/p>\n<p>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.<\/p>\n<p>Due to reasons I won&#8217;t go into now I had to restrict the imap process only to run on one of the server&#8217;s IPs; however I also need to access it from localhost for some of the server processes.<\/p>\n<p>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.<\/p>\n<p>So I had in cyrus.conf<\/p>\n<p><code style=\"margin-left: 30px\">imap\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 cmd=\"imapd -U 30\" listen=\"myhostname:imap\"  prefork=1 maxchild=100<\/code><\/p>\n<p><code style=\"margin-left: 30px\">imap-lh\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0  \u00c2\u00a0\u00c2\u00a0 cmd=\"imapd -U 30\" listen=\"localhost:imap\"  prefork=1 maxchild=100<\/code><\/p>\n<p>The problem was, as soon as I enabled this second line, cyrus went into  complete meltdown &#8211; connecting on one of the IPs just hung and  eventually timed out (and it seemed to be randomly chosen at restart  whether it&#8217;s the local or public IP which fails).<\/p>\n<p>I finally found a <a href=\"http:\/\/lists.andrew.cmu.edu\/pipermail\/cyrus-devel\/2008-April\/000828.html\" target=\"_blank\">posting in the cyrus mailing list<\/a> (lists.andrew.cmu.edu), which has had  no responses (typical) and explains it: there&#8217;s a bug in the cyrus code which  figures out the lockfile name &#8211; 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.<\/p>\n<p>So the &#8220;random&#8221; element was just whichever one connected second: renaming the second daemon to &#8220;imaplh&#8221; solves the problem.<\/p>\n<p>Hope this helps someone!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I couldn&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[8,13,12,11,10,9,14],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-tech","category-webdev","tag-cyrus","tag-freeze","tag-hang","tag-hosting","tag-imap","tag-mail","tag-two-ips"],"_links":{"self":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16"}],"version-history":[{"count":0,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=\/wp\/v2\/posts\/16\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weeklywhinge.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}