imapd: Killed (lost mailbox lock)

Trans-IX B.V.

Verified User
Joined
Mar 4, 2009
Messages
35
Location
The Netherlands
Dear Support,

We are struggling with multiple IMAP connections for a long time and now we have decided to post our problem here on the forum. IMAP works perfect but we get 'Killed (lost mailbox lock)' errors when an IMAP mailbox is being used from multiple IP addresses. Also the user is getting the well known error message in his Outlook (see attachment).

In this example we are using a fresh install of Direct Admin on CentOS 5.x (32-bit) with xinetd installed. But we are also experiencing this problem on our other Direct Admin servers.

The following errors are being logged in the /var/log/maillog :

Oct 14 11:25:37 web01 imapd[18765]: Killed (lost mailbox lock) [email protected] host=em1x-37.lhr.messaging.nokia.com [131.228.18.37]
Oct 14 11:26:15 web01 imapd[19151]: Killed (lost mailbox lock) [email protected] host=5ED4FBE.cm-7-5d.dynamic.ziggo.nl [94.212.25.22]
Oct 14 11:27:01 web01 imapd[19160]: Killed (lost mailbox lock) [email protected] host=em1x-71.lhr.messaging.nokia.com [131.228.18.71]
Oct 14 11:27:42 web01 imapd[19173]: Killed (lost mailbox lock) [email protected] host=5ED4FBE.cm-7-5d.dynamic.ziggo.nl [94.212.25.22]
Oct 14 11:28:07 web01 imapd[19179]: Killed (lost mailbox lock) [email protected] host=em1x-90.lhr.messaging.nokia.com [131.228.18.90]
Oct 14 11:28:52 web01 imapd[19193]: Killed (lost mailbox lock) [email protected] host=5ED4FBE.cm-7-5d.dynamic.ziggo.nl [94.212.25.22]

I found the following configuration files for xinetd and imap:

/etc/xinetd.conf
# This is the master xinetd configuration file. Settings in the
# default section will be inherited by all service configurations
# unless explicitly overridden in the service configuration. See
# xinetd.conf in the man pages for a more detailed explanation of
# these attributes.

defaults
{
# The next two items are intended to be a quick access place to
# temporarily enable or disable services.
#
# enabled =
# disabled =

# Define general logging characteristics.
log_type = SYSLOG daemon info
log_on_failure = HOST
log_on_success = PID HOST DURATION EXIT

# Define access restriction defaults
#
# no_access =
# only_from =
# max_load = 0
cps = 50 10
instances = 50
per_source = 10

# Address and networking defaults
#
# bind =
# mdns = yes
v6only = no

# setup environmental attributes
#
# passenv =
groups = yes
umask = 002

# Generally, banners are not used. This sets up their global defaults
#
# banner =
# banner_fail =
# banner_success =
}

includedir /etc/xinetd.d

/usr/local/directadmin/scripts/imapd.sh
#!/bin/sh

DA_PATH=/usr/local/directadmin
FILE=${DA_PATH}/scripts/packages/imapd
DEST=/usr/sbin/imapd
INET=${DA_PATH}/data/templates/imap

if [ ! -e $FILE ]; then
echo "Unable to find: $FILE";
exit 1;
fi

if [ ! -e $INET ]; then
echo "Unable to find: $INET";
exit 2;
fi

/bin/cp -f $FILE $DEST
/bin/chmod 755 $DEST
/bin/chown root:root $DEST

/bin/cp -f $INET /etc/xinetd.d/imap


#up the limit.

perl -pi -e 's/instances\s+= 60/instances = 256/' /etc/xinetd.conf

/sbin/service xinetd restart

exit 0;

The following 2 files have the same configuration:

/usr/local/directadmin/data/templates/imap
/etc/xinetd.d/imap

# default: on
# description: imapd
service imap
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/sbin/imapd
#log_on_success += DURATION USERID
#log_on_failure += USERID
nice = 10
}

Is there a way to get rid of these lost mailbox lock errors so that our users can use IMAP in a normal way?

If you need more information, please feel free to ask.

Thanks in advance!
 

Attachments

  • imap-imapd-killed-lost-mailbox-lock.gif
    imap-imapd-killed-lost-mailbox-lock.gif
    8.3 KB · Views: 250
Why are you doing anything with inetd? How old is your server? Why are you not using dovecot?
 
Why are you doing anything with inetd? How old is your server? Why are you not using dovecot?
We use CustomBuild with Exim so 'out of the box' IMAP is not working when you try to connect from an external IP.
That's why we are running xinetd as in the following KB:
http://help.directadmin.com/item.php?id=18

The server is only a few weeks old but we got this problem with all of our DirectAdmin servers. These servers also have the same configuration as the one used in my first post.

The reason we are not using Dovecot is because we are very familiar with Exim. We know all the ins and outs.. May this be the turning point to switch to Dovecot?
 
The reason we are not using Dovecot is because we are very familiar with Exim. We know all the ins and outs.. May this be the turning point to switch to Dovecot?
Exim and Dovecot are totally different programs, one is SMTP and the other is POP/IMAP.

AFAIK, the script now installs Dovecot by default?
 
Last edited:
The problem is that you are not using Dovecot, you appear to be using the older UW-IMAPD which only supports mbox storage format. The mbox format is a single file with all messages appended to each other. When a different connection attempts to open that mbox file, the server assumes the old ones are abandoned clients and kills them, since only one process can have a file opened read/write.

With Dovecot and Maildir storage format, each mail message is a single file, so the multiple readers/writers isn't as big of an issue. The chances that a client would write to the same file at the same time is pretty slim and there are some mechanisms to handle the cases when that happens.

Save yourself a lot of headaches and convert to Dovecot and use the Maildir format.
 
Dear toml,

Thanks for you response, in that case we will have to make the switch to Dovecot.

Can someone confirm that the Direct Admin backups we will restore from a Direct Admin Exim server will work with Dovecot?
 
Exim is an STMP server not an IMAP server, they are two different things. Assuming your backups used the older UW-IMAP server, then you can restore them to a server using Dovecot, and then you might want to following the instructions found on http://help.directadmin.com/item.php?id=109 to convert the mbox files into Maildir which Dovecot uses.
 
My recollection is (you may want to contact DirectAdmin support to be sure) is that if you restore an admin reseller backup made on a DirectAdmin server running UW-IMAP on mbox, it will automatically convert to Maildir when restored to a DirectAdmin server running Dovecot on Maildir.

Jeff
 
Back
Top