Memcached mlockall() fix

Kate Turner kate.turner at
Tue Jan 18 20:08:41 PST 2005


We had a problem with memcached -k not working.  The problem seems to
be that daemon(), setuid() and mlockall() are called in the wrong
order.  Specifically, the mlockall must be after daemon() (because it
does not follow fork()) and before setuid() (because it requires root
to take effect).  A patch to implement this can be found at
<> (sorry, it's
against 1.1.10 - apologies if this was fixed in a later version).  I
also added a setrlimit() to increase the locked memory limit to
unlimited, and some more error checking.  This has only been tested on
Linux, but seems to work.


More information about the memcached mailing list