[Bug 591100] Re: autofs5 eats the cpu if you have large groups
Martin Pitt
martin.pitt at ubuntu.com
Tue Aug 17 07:15:35 BST 2010
SRU ack, please upload.
** Also affects: autofs5 (Ubuntu Lucid)
Importance: Undecided
Status: New
--
autofs5 eats the cpu if you have large groups
https://bugs.launchpad.net/bugs/591100
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is a direct subscriber.
Status in “autofs5” package in Ubuntu: Fix Released
Status in “autofs5” source package in Lucid: New
Bug description:
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@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.
More information about the Ubuntu-sponsors
mailing list