[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Serious performance bug in Perl



'Wichert Akkerman wrote:'
>
>Previously Chris Fearnley wrote:
>> But yesterday I upgraded a bo system to hamm which has a 3000 line
>> /etc/passwd.  Now adduser takes OVER ONE MINUTE to find a UID and GID
>> for the new user.  And my staff is complaining about the wasted time.
>
>Are you sure it's a problem with perl? I've had the same problem with
>tar becoming dog-slow because I had `compat' in /etc/nsswitch.conf.
>Changing that to `nis files' fixed the speed-problem.

Goodness, the libc6 docs on the NSS mechanism are horrible.  But in
the interests of experimentation, I tried changing this from "compat"
to "files".  Still dog-slow.

>You could probably use strace to check what is really causing the delay.
>
>Wichert.

I did try strace it looked like it was doing illions of open's and
then mmap's on /etc/shadow at the point where it was slow.  Here is
the recurring part of the strace:
open("/etc/shadow", O_RDONLY)           = 5
fcntl(5, F_GETFD)                       = 0
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
fstat(5, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40126000
lseek(5, 0, SEEK_CUR)                   = 0
read(5, "root
...
After 12 reads on /etc/shadow, it repeats.  I added print statements
to adduser and it looks like it was the get_current_uid subroutine
where the performance problem occurs.  It has a loop on getpwent.
Maybe it's the C library that is buggy?

-- 
Christopher J. Fearnley          |  Linux/Internet Consulting
cjf@netaxs.com                   |  Design Science Revolutionary
http://www.netaxs.com/~cjf       |  Explorer in Universe
ftp://ftp.netaxs.com/people/cjf  |  "Dare to be Naïve" -- Bucky Fuller


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: