[Bug 591100] [NEW] autofs5 eats the cpu if you have large groups

Launchpad Bug Tracker 591100 at bugs.launchpad.net
Tue Aug 17 08:15:18 BST 2010


You have been subscribed to a public bug by Martin Pitt (pitti):

Binary package hint: autofs5

The issue is in lib/mounts.c,  set_tsd_user_vars - editing out the
boring bits, it looks like this:

grplen = sysconf(_SC_GETGR_R_SIZE_MAX);
       while (1) {
               char *tmp = realloc(gr_tmp, tmplen+1);
               status = getgrgid_r(gid, pgr, gr_tmp, tmplen, ppgr);
               if (status != ERANGE)
                       break;
               tmplen += grplen;
       }


It's trying to get the members of the users primary group, but doesn't know how big a buffer to allocate, so it keeps trying until the buffer is big enough, incrementing it each time.  The increment is only 1024 bytes at a time, however, so it takes several hundred iterations to get a big enough buffer.

This shouldn't be relying on_SC_GETGR_R_SIZE_MAX  to give a reasonable
increment.  See http://www.mail-archive.com/debian-
glibc at lists.debian.org/msg40443.html for some discussion about whether
the value of SC_GETGR_R_SIZE_MAX should really be that low, but it seems
that debian decided it should be, and the man page was wrong.

I've verified that bumping the increment value by 1000x fixes the issue,
and stat'ing non-existent homedirs is now instantaneous.

** Affects: autofs5 (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: autofs5 (Ubuntu Lucid)
     Importance: Undecided
         Status: New


** Tags: glucid
-- 
autofs5 eats the cpu if you have large groups
https://bugs.edge.launchpad.net/bugs/591100
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is a direct subscriber.



More information about the Ubuntu-sponsors mailing list