kmem_malloc(4096): kmem_map too small: 536870912 total allocated

Vladimir Sharun sharun at ukr.net
Tue Oct 25 05:25:59 PDT 2005


Pete French wrote:
>> I found the sources of the leak: if exim accessess ANY configuration/text 
>> files over NFS, there will be leak. And, how often exim will be called, then
>> quicker your system dies.

 PF> Surely this has to be a problenm wth NFS in the kernel, not with exim
 PF> though? Did you log a FreeBSD PR on this ? I've been following your tracking
 PF> of it with interest, and I don't want it to get lost in the noise!

So, the test:

#include <stdio.h>
#include <errno.h>
#include <fcntl.h>

int main() {
  int lockfd;
    char* tempfile="/media/testfile";
     lockfd=open(tempfile,O_CREAT);
     printf("Open errno:   %d\n",errno);
     if (flock(lockfd, LOCK_SH|LOCK_NB)==-1) {
     printf("ERROR shared lock:  %d\n",errno); }
  if (flock(lockfd, LOCK_EX|LOCK_NB)==-1) {  
        printf("ERROR exclusive lock:  %d\n",errno); }
   close(lockfd); }

If *ANY* lock will be transfered over a wire, memory after them will not be freed.
Regardless to errno. Even in case, where we do not start rpc.lockd 
(errno 45) or correctly start locking, in any case leak will be there. The only
way to avoid leak is mount NFS share with -L (do not transfer fcntl() locks over 
a wire). 
Systems affected: any FreeBSD 6.0 up to rc1.

Whoooh! 30 hours of investigations ;-)

-- 
UKR.NET Postmaster


More information about the freebsd-stable mailing list