04.04
After upgrading a VPS to Debian 6.0 “Squeeze” I ran into a baffling problem with the dovecot login processes that meant users could not log in to their mailboxes.
On examination, I found /var/logs/mail.err contained something like the following:
dovecot: child 1234 (login) returned error 127 dovecot: pop3-login: pop3-login: ... error while loading shared libraries: libgcrypt.so.11 ... failed to map segment from shared object: ... Cannot allocate memory dovecot: imap-login: imap-login: ... error while loading shared libraries: libgcrypt.so.11 ... failed to map segment from shared object: ... Cannot allocate memory
“cannot allocate memory” eh? But free showed there was plenty of memory available. What was going on?
It turned out that, after an upgrade to Squeeze, the login_process_size parameter in /etc/dovecot/dovecot.conf needed to be increased. I had it at 32; bumping it up to 64 and restarting dovecot solved the login problems.
# Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. login_process_size = 64
I imagine the memory footprint of the upgraded shared libraries was a little larger than before and was enough to run into the configured 32Mb process size limit. Currently the login processes are sitting at about 38-40Mb each, which would back up this theory.
Although simple to fix in the end, this was a bit of a headscratcher to find, and I hope this post will help someone in a similar situation.
Related Posts
No related posts.

I wanted to reduce dovecot memory need and the too much login processes, but I ran into the exact same problem.
Thanks a lot, this really solves it (also, I had a very similar error, just that time it was libdl.so.2 ).
it did! thanks a lot
[...] I read almost every similar bug / issue / blogpost and could only find that one that believe not exactly same issue but quite similar: http://www.johngirvin.com/archives/dovecot-error-127-after-upgrading-to-debian-squeeze.html [...]