Underscore in SERVICES-names can cause deadlocks.

Robert Linden r.linden at tarent.de
Tue Mar 20 12:07:12 EDT 2012


Hello!

I just encountered a rather tricky problem and maybe somebody can benefit from 
the solution.

If one wants to have multiple instances of imapd, for example to support IMAP 
and IMAPS, or to listen on multiple interfaces (but not all/0.0.0.0, or if one 
needs different configurations for the separate services), then the recommended
way is to just have multiple lines in the SERVICES section.

The name of the service (first parameter in the line) is also used in the 
filename of a lockfile, that needs to be unique for each service, otherwise a 
deadlock can occur, where multiple services want to hold a lock on the same 
file. The result will be 1-2 minute long freezes on any connection attempt.

This problem was already described by Tuomas Toropainen in this mail:

http://lists.andrew.cmu.edu/pipermail/info-cyrus/2007-January/024910.html

The tricky part is, that not all names that look distinct really are treated 
differently by cyrus. Notable example: "imap" and "imap_remote" result
in the same lockfile (/var/imapd/socket/imap-0.lock), because the name is 
truncated at the '_'. The '_' doesn't seem to be illegal per se, because cyrus 
does not complain and the service runs ok most of the time, i.e. as long as no 
concurrent connections are created on the 2 interfaces to trigger the race-
condition.

Maybe other characters cause this problem as well, so if one is unsure about 
this it would be best to just stick to alphanumeric characters.

I have also added this information to the FAQ at 
http://www.cyrusimap.org/mediawiki/index.php/FAQ

HTH,
rob


More information about the Info-cyrus mailing list